I am submitting HTTP POST requests via HttpWebRequest which contain a large amount of content. I would like to gzip the message content. Is this possible?
Does IIS 7 have to be configured to handle the compressed content? It has already been configured to serve compressed responses.
I've tried adding a Content-Encoding = gzip header and writing to the request stream wrapped in a GZipStream but the server returns a 504 (GatewayTimeout) which seems odd.
The vast majority of web servers do not support compressed request bodies. mod_deflate
can be configured to support it on Apache but seldom actually is (as a zip-bomb is an easy potential DoS attack). I'm not aware of an IIS solution.
If you are talking back to your own server there is of course nothing stopping you doing the compression at the application level. If you have to pass a standard form type for the backend to read, you should pick multipart/form-data
, as URL-encoding would bloat the binary data of the compressed content parameter.