Paulo Morgado

.NET Development & Architecture

Recent Articles

view all

Events

Projects

Recent Readers

Visitor Locations

Visitor Locations

Disclaimer

The opinions and viewpoints expressed in this site are mine and do not necessarily reflect those of Microsoft, my employer or any community that I belong to. Any code or opinions are offered as is. Products or services mentioned are purchased by me, made available to me by my employer or the manufacturer/vendor which doesn't influence my opinion in any way.

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.

Posted: Mar 25 2008, 02:44 AM by Paulo Morgado | with 2 comment(s)
Filed under: ,

Comments

Phil said:

This would only compress the response, not the request itself...  If you only need to compress the responses: check www.ddj.com/.../184405969 because adding the header isn't enough: you need to decompress the stream on the client too.  But how to compress the request itself when you post a large data structure?

# June 10, 2008 7:13 PM

Paulo Morgado said:

That would depend on the techonlogy being used. I don't believe a web browser would do it.

# June 10, 2008 8:16 PM
Leave a Comment

(required) 

(required) 

(optional)

(required)