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 ...