cURL / Mailing Lists / curl-library / Single Mail


Re: Bypassing libcurl's handling of content-encoding and

From: Shmulik Regev <>
Date: Mon, 12 Feb 2007 13:30:23 +0200


I've managed to locate the problem you've pin-pointed and to (hopefully) fix
it. The solution is to always call Curl_client_write (at the beginning of
Curl_httpchunk_read) regardless of the actual chunk parsing state. This also
makes the code simpler (which is always a good sign of a correct fix :) .
The patch against the current cvs version is attached (as a separate file,
not to be confused with the tiny patch below).

As you recall debugging the problem was a challenge by itself, due to the
varying nature of your testing code which didn't reply to my requests in the
same manner it replied to yours. I did try to simulate the problem using a
self-made script, and with using it, the fix seems ok. I do ask you however
to review it again on your environment.

Lastly, I noticed that when running curl with the --trace option, the
produced output does NOT contain the terminating CRLF of the response.
Perhaps it is intentional, but if it isn't, here is a tiny patch to fix it

--- C:/dev/sandbox/curl-cvs/curl/lib/transfer.c Mon Feb 12 12:43:28 2007
+++ C:/dev/sandbox/curl-cvs/curl-7.16.1-20070207/lib/transfer.c Mon Feb
12 13:22:15 2007
@@ -689,6 +689,11 @@
                   k->keepon &= ~KEEP_READ;

+ if(data->set.verbose)
+ Curl_debug(data, CURLINFO_HEADER_IN,
+ k->str_start, headerlen, conn);
                 break; /* exit header line loop */


Received on 2007-02-12