cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Compression & Decompression - Encryption & Decryption support

From: Daniel Stenberg <daniel_at_haxx.se>
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 http://curl.haxx.se/mail/lib-2008-11/0139.html, 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
> CURLOPT_TRANSFER_ENCODING do?

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

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.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2012-01-29