cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: gzip negotiation on PUT transfers

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Wed, 12 Nov 2008 13:07:55 -0800

On Wed, Nov 12, 2008 at 02:20:35PM -0500, garym_at_xmlteam.com wrote:
> This is a little OT, although I do need to do this with libcurl :) but

That's fine, just don't reply to an existing message when you start a new
topic--it messes up threading in people's mailers and the archive.

> I'm a rank novice at this and having some trouble finding the right
> chapter in the docs (so specific rtfm directives are very welcome)
>
> what I need to do is the reverse of the Apache mod-deflate; I would
> like to make a PUT request to a remote server, and if that server
> supports gzip compressed streams, I want to submit the body in gzip
> format, otherwise I should submit the body as plain text/xml
>
> can this be done? is it just a header? Can PUT do this sort of
> optionally-compressed content negotiation?

libcurl can handle automatic decompressing on downloads but not the reverse,
namely what you want. You might be able to do what you want by setting a
Content-Encoding: gzip in the request along with a 100-continue header.
The server then has a chance to abort the transfer if it doesn't support
gzip, but I suspect some servers won't support this. I'm not sure what
other way you can tell if the server supports gzip or not.

>>> Dan

-- 
http://www.MoveAnnouncer.com              The web change of address service
          Let webmasters know that your web site has moved
Received on 2008-11-12