Does the common HTTP server implementation decompress POSTed form data?
If I 开发者_开发知识库GZip the a POST request form data, will a HTTP server decompress it, or it only works the other way (server -> client)?
What web server are you using? I'm assuming your doing the POST from within a program. While it's possible send gzip'd data to a server, browsers don't do it, because the server doesn't usually advertise what encodings it accepts. You can see what a server accepts with an OPTIONS command:
curl -iX OPTIONS http://localhost:8080/
HTTP/1.1 200 OK
Date: Tue, 20 Oct 2009 00:54:29 GMT
Server: Apache/2.2.8 (Unix) mod_ssl/2.2.8 OpenSSL/0.9.8a DAV/2 PHP/5.2.6 SVN/1.6.5 proxy_html/3.0.0
Allow: GET,HEAD,POST,OPTIONS,TRACE
Vary: User-Agent
Content-Length: 0
Content-Type: text/html
However, if you control both the server and the client, you can send whatever data stream you like. For example, Mercurial compresses everything in both directions, but doesn't rely on the web server for compression/decompression.
精彩评论