|  | 
 |  | 
| 
 | cURL  Mailing List  Monthly Index  Single Mail curl-tracker mailing list Archives
 [ curl-Bugs-1531838 ] uploads with chunked encoding broken if header specified
From: SourceForge.net <noreply_at_sourceforge.net>
 Date: Wed, 02 Aug 2006 11:20:50 -0700 
Bugs item #1531838, was opened at 2006-07-31 18:11
 Please note that this message will contain a full copy of the comment thread,
 Initial Comment:
 curl_easy_setopt(new_req->mCurlHandle, CURLOPT_UPLOAD, 1);
 headers = curl_slist_append(headers, "Transfer-Encoding: chunked");
 curl_easy_setopt(new_req->mCurlHandle, CURLOPT_READFUNCTION,
 // don't set CURLOPT_INFILESIZE
 This causes libCURL to announce the request body (the upload) as 
 The bug is in http.c, starting with the line:
 if(!conn->bits.upload_chunky && (httpreq != HTTPREQ_GET)) {
 As currently written, the logic runs like this:
 if the upload is chunk (as the CURLOPT_INFILESIZE is not specified)
 This second if should probably be something like:
 ptr = checkheaders(data, "Transfer-Encoding:");
 So the logic is more like:
   if there no transfer-encoding header, or if it is chunked
 markl_at_lindenlab.com
 ----------------------------------------------------------------------
 >Comment By: Daniel Stenberg (bagder)
 Message:
 Many thanks for your report and your patch.
 I've applied and committed.
 ----------------------------------------------------------------------
 Comment By: Mark Lentczner (mark_lentczner)
 Message:
 a patch that fixes this issue is now attached.  This patch might look like it 
 Furthermore, the test for GET is irrelevant, as upload_chunked is only set if in 
 ----------------------------------------------------------------------
 Comment By: Mark Lentczner (mark_lentczner)
 Message:
 You can easily reproduce the bug simply using command line curl:
 U=http://www.ozonehouse.com/mark/test-sl/foo2.pl
 (Note: the URL doesn't really matter, it just needs to be someplace that will 
 Looking at the -v output, you'll see that both are identical, and both use 
 Now, if you run tcpdump while running the commands you can see the 
         0x0030:  0c71 ccd8 340d 0a62 6172 0a0d 0a         .q..4..bar...
 That's 4 bytes ("bar\n") and then the data and a trailing \r\n.
 With the second command, the first packet from curl after the 100 Continue 
         0x0030:  0c72 e8c7 6261 720a                      .r..bar.
 When Apache is tries to interpret this as a chunk response it seems to hang 
 Notice that the only difference between the two curl commands is that the 
 Finally, I uncovered this coding to libcurl, so it isn't a bug in the command 
 I will try to work on a patch fix later... but you may be able to figure it out 
 ----------------------------------------------------------------------
 Comment By: Daniel Stenberg (bagder)
 Message:
 Thanks for your report!
 Can you please:
 1. tell us a way to repeat this problem?
 2. show us your suggested fix with a diff -u output? Your
 ----------------------------------------------------------------------
 You can respond by visiting: 
 These mail archives are generated by hypermail. | 
 Page updated November 12, 2010.
Page updated November 12, 2010.
web site info