cURL / Mailing Lists / curl-library / Single Mail


Re: Compression & Decompression - Encryption & Decryption support

From: Daniel Stenberg <>
Date: Sun, 29 Jan 2012 23:54:47 +0100 (CET)

On Sun, 29 Jan 2012, sandeep a wrote:

> I was looking for libcurl support to do on the wire compression of files to
> be uploaded (using PUT).
> But when I saw the post, I
> understood that on the wire decompression is supported by libcurl but not on
> the wire compression.
> Is this still valid?

There's no HTTP protocol support for compressing request data so you need to
come up with your own way of doing it.

Using the read callback you can of course compress the stream as you see fit
or you can just upload a file that is compressed before sent.

> I did a lot of reading about CURLOPT_ACCEPT_ENCODING and
> CURLOPT_TRANSFER_ENCODING, but I still could not understand what does

"Adds a request for compressed Transfer Encoding in the outgoing HTTP

It tells the server that it can handle compressed transfer-encoding so that
the server can send the transfer compressed. It is slightly different than
content-encoding but in reality compression over HTTP is mostly done using the
latter approach.

> Is it something like, CURLOPT_TRANSFER_ENCODING will compress my HTTP body
> and send it across? What exactly CURLOPT_TRANSFER_ENCODING does to my HTTP
> request I send on wire. Does it zip or gzip my file and send it on wire?

Both of them are for making the _server_ send compress data to the client.

> Also, is there any kind of support from libcurl to do encryption and
> decryption to my files that I want to upload (using PUT). Though directly
> not supported, may be by compiling some library along with libcurl.

Nope. You need to do that using some other library or tool.

List admin:
Received on 2012-01-29