cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Deflate issue?

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Thu, 21 Aug 2003 11:05:07 -0700

On Tue, Aug 19, 2003 at 08:55:18PM -0700, Mark Fletcher wrote:
> Hi,
>
> Using 7.10.6, I get a CURLE_WRITE_ERROR for the following url:
>
> http://www.panopticoncentral.net/rss.aspx
>
> I traced it down to Curl_unencode_deflate_write() failing. I can load
> the file fine from Mozilla and wget(otherwise I'd just assume that the
> site was broken). Here's how my curl is configed:
>
> curl_easy_setopt( data->curl, CURLOPT_WRITEDATA, data );
> curl_easy_setopt( data->curl, CURLOPT_WRITEFUNCTION, curlData );
> curl_easy_setopt( data->curl, CURLOPT_HEADERFUNCTION, curlHeader );
> curl_easy_setopt( data->curl, CURLOPT_WRITEHEADER, data );
> curl_easy_setopt( data->curl, CURLOPT_FOLLOWLOCATION, 1 );
> curl_easy_setopt( data->curl, CURLOPT_MAXREDIRS, 5 );
> curl_easy_setopt( data->curl, CURLOPT_FAILONERROR, 1 );
> curl_easy_setopt( data->curl, CURLOPT_DNS_CACHE_TIMEOUT, 0 );
> curl_easy_setopt( data->curl, CURLOPT_DNS_USE_GLOBAL_CACHE, 0 );
> curl_easy_setopt( data->curl, CURLOPT_ENCODING, "" );
> curl_easy_setopt( data->curl, CURLOPT_TIMEOUT, 60 );
> curl_easy_setopt( data->curl, CURLOPT_CONNECTTIMEOUT, 60 );
>
> Any suggestions?

A cursory check of this URL seems to show that the deflate data sent by
the web server is missing the zlib deflate stream header when deflate
is used. If that's true, then curl is right to complain. That server
also supports gzip compression with the proper data format, so replacing
the line above with:

   curl_easy_setopt( data->curl, CURLOPT_ENCODING, "gzip" );

should work on this particular server.

It's possible the other browsers either don't support deflate or are
switching the order of compression protocols in their Accept-Encoding: header
which is why they work. Still, it's probably worthwhile doing some more
tests to make sure the data is truly corrupted and it's not a problem in the
way curl is using zlib.

>>> Dan

-- 
http://www.MoveAnnouncer.com              The web change of address service
          Let webmasters know that your web site has moved
-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines
at the same time. Free trial click here:http://www.vmware.com/wl/offer/358/0
Received on 2003-08-22