cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: How to get compressed data?

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Wed, 5 Jan 2011 11:33:30 -0800

On Wed, Jan 05, 2011 at 06:59:33PM +0100, Felix E. Klee wrote:
> On Wed, Jan 5, 2011 at 6:52 PM, Felix E. Klee <felix.klee_at_inka.de> wrote:
> > I'd like to instruct libcurl to *not* decompress compressed responses.
> > Is this possible?
>
> Just a quick idea:
>
> * CURLOPT_ENCODING: NULL
>
> * CURLOPT_HTTPHEADER: function that sets Accept-Encoding to
> "gzip,deflate"
>
> * CURLOPT_HEADERFUNCTION: function that reads Content-Encoding
>
> Is that the way to go?

That should work fine.

> PS: I want to store the respons in a database, and leaving it
> uncompressed should increase performance and safe space.

Presumably, you're already taking care of this but not all servers or URLs
support compression.

>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-01-05