gpt4 book ai didi

javascript - Range header 是压缩字节还是未压缩字节的大小(以字节为单位)?

转载 作者:行者123 更新时间:2023-11-29 21:42:41 25 4
gpt4 key购买 nike

为了学习和娱乐,我正在 node.js 中实现静态文件服务。假设我要发送一个名为 party-time.txt 的文件,它是:

100 bytes uncompressed

70 bytes gzipped

如果用户请求 Range: bytes=-10,这个请求是针对最后 10 个未压缩字节(例如 91-100)还是最后 10 个压缩字节(例如 61- 70)?

最佳答案

HTTP retrieval requests using conditional or unconditional GET methods MAY request one or more sub-ranges of the entity, instead of the entire entity, using the Range request header, which applies to the entity returned as the result of the request.

14.35.2 Range Retrieval Requests

因为从请求返回的实际实体是 gzip 编码数据,该数据用于派生 Content-Length,因此范围适用于它。

关于javascript - Range header 是压缩字节还是未压缩字节的大小(以字节为单位)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32208942/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com