]> granicus.if.org Git - curl/commitdiff
retry-request: rewind if data was sent
authorDaniel Stenberg <daniel@haxx.se>
Sun, 20 Mar 2011 22:24:45 +0000 (23:24 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Sun, 20 Mar 2011 22:24:45 +0000 (23:24 +0100)
When libcurl sends a HTTP request on a re-used connection and detects it
being closed (ie no data at all was read from it), it is important to
rewind if any data in the request was sent using the read callback or
was read from file, as otherwise the retried request will be broken.

Reported by: Chris Smowton
Bug: http://curl.haxx.se/bug/view.cgi?id=3195205

lib/transfer.c

index 266b83441717a511bb99f47d09b9b2bba88bc0ba..c33cf13fd354079d04b0f51daa88a1edad7a9805 100644 (file)
@@ -2085,6 +2085,9 @@ CURLcode Curl_retry_request(struct connectdata *conn,
                                 prevent i.e HTTP transfers to return
                                 error just because nothing has been
                                 transfered! */
+
+    if(data->state.proto.http->writebytecount)
+      Curl_readrewind(conn);
   }
   return CURLE_OK;
 }