cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: CURLOPT_ENCODING: downloads and uploads

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 21 Aug 2003 15:31:43 +0200 (CEST)

On Wed, 20 Aug 2003, Mohun Biswas wrote:

> 1. It's clear, both from documentation and experimentation, that simply
> specifying
>
> curl_easy_setopt(curl, CURLOPT_ENCODING, "");
>
> causes a generous Accept-Encoding header to be sent. But is it the case
> that, as long as one has a modern libcurl and links with zlib, that
> compressed content will not only be "accepted" but actually decompressed
> without further ado?

First, you will only get a proper Accept-Encoding header sent if you did build
libcurl with zlib. If zlib wasn't present and you use CURLOPT_ENCODING, ""
you'll only make libcurl request uncompressed data.

If the server then replies with compressed data, libcurl will decompress it
automaticly and your application will not even notice if the data is
compressed or not.

> Or must I arrange to send data from curl callbacks to the zlib stream
> interfaces by hand?

Nope.

> 2. The above accounts for downloaded data. Is there still no built-in
> support for uploading compressed data? Or, is there a sample program
> anywhere showing how to use gzip compression with multipart file uploads? I
> can't see a way of streaming data to a connection via the curl_formadd()
> interface. Is this possible at all, or would it be necessary to build the
> entire compressed file contents into a buffer and pass that?

libcurl has no built-in support for automatic compression on uploads. I'm not
really familiar with how that is negotiated with the server either, so I can't
tell you right now how to do it.

If anyone has made any work on making libcurl support this, then please raise
your hand.

-- 
 Daniel Stenberg -- curl: been grokking URLs since 1998
-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines
at the same time. Free trial click here:http://www.vmware.com/wl/offer/358/0
Received on 2003-08-22