我试图让我的web服务器正确地gzip一个http响应,它是块编码。分块编码响应的gzip压缩?
我非gzip的响应的理解是,它看起来像这样:
<the response headers>
,然后对于每个大块,
<chunk length in hex>\r\n<chunk>\r\n
终于,零长度块:
0\r\n\r\n
我试图让gzip压缩工作,我可以使用一些帮助确定什么应该交流一定会被退回。本文档意味着整个响应应该用gzip压缩,而不是使用gzip压缩每个块:
HTTP servers sometimes use compression (gzip) or deflate methods to optimize transmission.
Chunked transfer encoding can be used to delimit parts of the compressed object.
In this case the chunks are not individually compressed. Instead, the complete payload
is compressed and the output of the compression process is chunk encoded.
我试图gzip压缩了整个事情,即使没有分块返回响应,并没有奏效。我尝试将Content-Encoding标头设置为“gzip”。有人可以解释一下上面的方案必须做什么改变来支持gzip块吗?谢谢。
他说他在做什么,对吧? – sosiouxme 2012-01-19 21:19:49
第一句话在这真是令人困惑。我认为它应该改变.....你gzip每个块的身体(我刚刚实施它,它像一个魅力工作)。您不会gzip整个内容,然后应用分块编码。你可以gzip每个主体并将块大小标记为压缩的字节数组大小。 – 2016-08-30 04:27:09