Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I am receiving xml files on my server using the HTTP PUT request. Is it compressed during the transfer if my Apache is configured with mod_deflate? How can I verify that it is compress? If not, how can I force the compression?

Thanks!

share|improve this question

2 Answers 2

up vote 2 down vote accepted

As per my previous answer:

A browser requests content to be compressed by setting Accept-Encoding header as per here

GET /index.html HTTP/1.1
Host: www.http-compression.com
Accept-Encoding: gzip
User-Agent: Firefox/1.0

This will return compressed data to the browser. However, to PUT data to the server compressed, you must compress the whole request, inclusive of header. It's documented in mod_deflate:

The mod_deflate module also provides a filter for decompressing a gzip compressed request body. In order to activate this feature you have to insert the DEFLATE filter into the input filter chain using SetInputFilter or AddInputFilter.

...

Now if a request contains a Content-Encoding: gzip header, the body will be automatically decompressed. Few browsers have the ability to gzip request bodies. However, some special applications actually do support request compression, for instance some WebDAV clients.

And an article describing it is here:

So how do you do it? Here is a blurb, again from the mod_deflate source code: only work on main request/no subrequests. This means that the whole body of the request must be gzip compressed if we chose to use this, it is not possible to compress only the part containing the file for example in a multipart request.

share|improve this answer

The mod_deflate is used when apache sends data, not when receiving.

The thing is that the browser sends data to the web server before having any knowledge of what it supports, thus, it cannot compress data, not knowing if the server will be able to handle it.

If you're really in need a lower bandwidth usage, you should have the xml files compressed before sending them, and uncompressed them in your application.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.