cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: CURLOPT_ENCODING: downloads and uploads

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Thu, 21 Aug 2003 10:21:38 -0700

On Wed, Aug 20, 2003 at 10:15:07PM -0400, Mohun Biswas wrote:
> I just want to check my understanding of the way content encoding is
> handled. I've read about CURLOPT_ENCODING in the curl_easy_setopt page,
> I've found the README.encoding file, and have scanned the email archives
> from ~4/2003 describing the initial patches. But there are a few things
> still not obvious to a person coming to this topic for the first time:
>
> 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? Or must I arrange to send data from curl callbacks
> to the zlib stream interfaces by hand?

Compressed pages will be transparently uncompressed by libcurl if this
option is set and the received encoding is supported. curl -V will tell
you if you've linked with zlib. No extra work on your part is needed.

> 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?

There is no support for automatic compressing of data when uploading. I'm
not familiar with the form uploading API to definitively answer the second
part, but I imagine there's some way to manually send and parse the
appropriate headers to enable compression and then compress the data in
the upload callback function.

>>> Dan

-- 
http://www.MoveAnnouncer.com              The web change of address service
          Let webmasters know that your web site has moved
-------------------------------------------------------
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