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.

4 Responses to Is it possible to compress a HTTP request?

  • Amichai says:

    Is it possible to configure a browser to compress requests?

    BTW – I’ve tried doing it via wfetch and it seems the server treats the data as regular data – sent a PUT request with compressed data – the server loaded it to site as refular data.

    Amichai

  • Not any browser that I know of.

    What is the server doing with the data?

  • it support says:

    Interesting post, not sure I agree fully although you make some excellent points, thanks for a good read.

  • paulo says:

    Would you care to elaborate a bit on what you didn’t agree with?