我試圖讓我的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