gzip 壓縮

客戶端首先傳送一個帶有 Accept-Encoding 標頭的請求,表明它支援 gzip:

GET / HTTP/1.1\r\n
Host: www.google.com\r\n
Accept-Encoding: gzip, deflate\r\n
\r\n

然後,伺服器可以傳送帶有壓縮響應主體和 Content-Encoding 頭的響應,該頭指定使用了 gzip 編碼::

HTTP/1.1 200 OK\r\n
Content-Encoding: gzip\r\n
Content-Length: XX\r\n
\r\n
... compressed content ...