cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: gzip compression of post data.

From: <johansen_at_sun.com>
Date: Thu, 17 Dec 2009 17:36:35 -0800

On Thu, Dec 17, 2009 at 01:58:55PM -0800, Jason Corcoran wrote:
> Hi there,
>
> I have a couple of issues with my curl app. At the moment, we are
> sending 10 MB of data and we want to compress this. I understand that I
> should set the Accept-Encoding to gzip, deflate but what else should I
> set? What is the standard way to compress the data? and lastly are there
> any examples out there of doing this with libCurl.

Please have a look at lib/README.encoding in the Curl source tree.
Setting Accept-Encoding by using CURLOPT_ENCODING is a polite request to
the server to send a compressed response, if it can.

If you want the client to send compressed data to the server, you'll
need to compress the data yourself and add the compressed content to the
post request. The server will have to know how to figure out that
you're sending it compressed data.

Curl has two different POST interfaces. The first is described here:

http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTPOST

The second used curl_formadd:

http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTHTTPPOST
http://curl.haxx.se/libcurl/c/curl_formadd.html

-j
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2009-12-18