cURL / Mailing Lists / curl-library / Single Mail

curl-library

Should curl be unzipping a gzipped response?

From: Graham Charters <gcharters_at_googlemail.com>
Date: Mon, 5 Feb 2007 17:04:28 +0000

Hi,

I tried the following question on the PHP list, but got no response.
It's not really a PHP specific question so I'm hoping this is the
right list - my apologies if it's not...

I'm using the PHP curl extension to prototype RSS client support in a
project I work on. I recently encountered an example of a feed which
was coming back gzip compressed. I was under the impression that curl
would automatically unzip a gzipped response for me, but the response
is still compressed. I can unzip the response myself but I'm concerned
that this will break if the behaviour changes.

Could someone please tell me whether or not curl should be unzipping
the response, or whether there is something I need to do to enable
this?

Any help would be greatly appreciated. Many thanks.

More details follow (a little PHP specific)...

My request headers include the following:

Accept-Encoding: gzip

And the response headers include:

Content-Encoding: gzip

The relevant (I think :-) ) parts of my request code are:

curl_setopt($handle, CURLOPT_HEADER, false);
curl_setopt($handle, CURLOPT_ENCODING, "gzip");
$result = curl_exec($handle);

I can unzip the response using the following and the result looks fine:

$unzipped = gzinflate(substr($result,10));

FYI: I've tried this with curl 7.15.5 and 7.16.1 (built with Open SSL
0.9.8b and d) and the result is the same for both.

Regards,

Graham.
Received on 2007-02-05