cURL / Mailing Lists / curl-users / Single Mail

curl-users

[ curl-Bugs-420667 ] chunked followed by fixed transfer fails

From: <noreply_at_sourceforge.net>
Date: Tue, 01 May 2001 23:00:38 -0700

Bugs item #420667, was updated on 2001-05-01 23:00
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=100976&aid=420667&group_id=976

Category: http
Group: bad behaviour
Status: Open
Resolution: None
Priority: 5
Submitted By: Cris Bailiff (crisb)
Assigned to: Daniel Stenberg (bagder)
Summary: chunked followed by fixed transfer fails

Initial Comment:
libcurl has a problem switching from chunked transfers
to 'regular' transfers on persistant http connections.

I found this in a perl script, but its reproducible
from the curl command line:

Access a body part which is of variable length via a
http1.1 persistent connection - my example below
accesses the 'printenv' cgi script on the local apache
server. This results in a 'chunked' transfer, and the
connection should stay open.

Then, using the same connection, asked for a URL (on
the same server) which has a fixed size (a static file,
for example), which will be returned using
'Content-Length' rather than 'Transfer-Encoding:
chunked'. Curl barfs at the start of the second
request, and closes the connection.

Heres the simple example:

[crisb_at_dipsy crisb]$ curl
http://localhost/cgi-bin/printenv
http://localhost/index.html >/dev/null

  % Total % Received % Xferd Average Speed
Time Curr.
                                 Dload Upload Total
Current Left Speed
100 742 0 742 0 0 30401 0 --:--:--
0:00:00 --:--:-- 0

curl: (18) transfer closed with 85068 bytes remaining
to read

Its the switch from chunked to 'regular' that causes
the problem. Consecutive chunked or regular are fine,
as is the switch from regular to chunked - its just the
chunked to regular that makes it die. Proof:

 curl http://localhost/index.html
http://localhost/cgi-bin/printenv
http://localhost/cgi-bin/printenv
http://localhost/index.html >/dev/null
  % Total % Received % Xferd Average Speed
Time Curr.
                                 Dload Upload Total
Current Left Speed
100 85068 100 85068 0 0 12.1M 0 0:00:00
0:00:00 0:00:00 35916
  0 85068 0 742 0 0 32393 0 0:00:02
0:00:00 0:00:02 0
  0 85068 0 742 0 0 37486 0 0:00:02
0:00:00 0:00:02 0
curl: (18) transfer closed with 85068 bytes remaining
to read
[crisb_at_dipsy
crisb]$

No fix at present - still digging.

Workaround: set CURLOPT_FRESH_CONNECT on your curl
handle to make it use a new connection each time, or
perform command line requests separately. Kills your
persistent connection though...

----------------------------------------------------------------------

You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=100976&aid=420667&group_id=976
Received on 2001-05-02