|   | 
  | 
| 
 
  | 
cURL   Mailing List   Monthly Index   Single Mail
curl-tracker Archives
 [ curl-Bugs-3214223 ] Pipelined HTTP requests with a zero-length body broken
From: SourceForge.net <noreply_at_sourceforge.net>
 
Date: Tue, 15 Mar 2011 21:06:33 +0000 
Bugs item #3214223, was opened at 2011-03-15 21:06
 Please note that this message will contain a full copy of the comment thread,
 Initial Comment:
 cURL is running pipelined. It's trying to get a series of three documents from the server, call them http://server/one, two and three. 'one' is zero-length.
 What happens:
 1. cURL sends all three requests
 The problem: that buffer saved in conn->master_buffer contains not only the zero-length request's headers, but also the headers and body of its successor requests. However it will never yield them unless we set conn->read_pos using read_rewind, but we only do that if we read a short body, *not* if we set stop_reading, which bails out immediately.
 Consequently the responses which were in that buffer are silently dropped, and subsequent requests get paired with replies which are not their own! Example: Requests 1, 2 and 3 meet reply-packets [1, 2] and [3]. Request 1 is zero-length, triggering the bug and silently discarding the rest of its packet. Request 2 is then answered using reply [3]... curse HTTP's lack of a transaction-identifier field!
 Solution: read_rewind whenever we've read too much data, not just in the special cases dealt with further down readwrite.
 I attach as always a pair of test cases, somewhat tricky this time: a server and a client. They'll prompt you to press enter a few times: the drill should be:
 1. Start server ("dumb_server 9000")
 To check, see /tmp/curl_*_out.
 If it works right, you'll get:
 curl_zero_out: "init"
 If the bug manifests, instead you'll get:
 curl_zero_out: "init"
 Note that the third request has not returned, whilst the second has been given the value that rightfully belongs to the third.
 I'd really appreciate a fix to this one, as I can't find a workaround that isn't disabling pipelining.
 ----------------------------------------------------------------------
 You can respond by visiting: 
 These mail archives are generated by hypermail.  | 
Page updated November 12, 2010.
web site info