Category Archives: 7190

Is it possible to compress a HTTP request?

Recently I was asked (related to my articles [^] [^] about HTTP compression) if it was possible to compress the contents of a web service call.

The way HTTP compression works (as far as I know) is by the client announcing to the server (using the accept-encondig request HTTP header) what compression methods is capable of handling.

If the server is capable of using one of the accepted compression methods, compresses the response and specifies (using the content-encoding HTTP response header) the compression method used.

The client usually doesn’t know if the server accepts any kind of encoding, so it shouldn’t impose any compression to the server.

One way to allow request compression and having the server handling it would be to send a content-encoding HTTP header specifying the compression method of the request and having the server handling it and the BeginRequest event by setting a HttpResponse.Filter capable of uncompressing the request. This way it would be transparent to the request handling.

NOTE: I didn’t test this.