]> granicus.if.org Git - curl/commitdiff
- Dmitry Kurochkin fixed Curl_done() for pipelining, as it could previously
authorDaniel Stenberg <daniel@haxx.se>
Tue, 29 Jan 2008 12:58:25 +0000 (12:58 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 29 Jan 2008 12:58:25 +0000 (12:58 +0000)
  crash!

CHANGES
RELEASE-NOTES
docs/KNOWN_BUGS
lib/url.c

diff --git a/CHANGES b/CHANGES
index 6701faae8e8c21fa9825b446772d2736c4727ff5..e12d9ed188c025f5e80835a9c73333cd7394d9c0 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -7,6 +7,9 @@
                                   Changelog
 
 Daniel S (29 Jan 2008)
+- Dmitry Kurochkin fixed Curl_done() for pipelining, as it could previously
+  crash!
+
 - Michal Marek fixed minor mistake in test case 553 that prevented it from
   working on other IP-addresses or port numbers.
 
index 5a9f5848c4e0d6766136287ffecf592fc95f33f2..b8eabdb92157f1ffedeac6327451d3d3577564e0 100644 (file)
@@ -14,7 +14,7 @@ This release includes the following changes:
 
 This release includes the following bugfixes:
 
- o 
+ o improved pipelining
 
 This release includes the following known bugs:
 
@@ -31,6 +31,6 @@ New curl mirrors:
 This release would not have looked like this without help, code, reports and
 advice from friends like these:
 
- Michal Marek
+ Michal Marek, Dmitry Kurochkin
 
         Thanks! (and sorry if I forgot to mention someone)
index 566592ffdb27be4bc2b549fb96bf91f0c0b52bb3..c40219bb4813a8ecf00c8bd25427be9bdf838f70 100644 (file)
@@ -12,9 +12,6 @@ may have been fixed since this was written!
   wants NTLM and close the connection to the initial CONNECT response:
   http://curl.haxx.se/bug/view.cgi?id=1879375
 
-50. Curl_done() and pipelning aren't totally cool together:
-  http://curl.haxx.se/mail/lib-2008-01/0330.html
-
 49. If using --retry and the transfer timeouts (possibly due to using -m or
   -y/-Y) the next attempt doesn't resume the transfer properly from what was
   downloaded in the previous attempt but will truncate and restart at the
index 5a47e289aabb53817ca4c45b840e2354559bd11f..4fab64486e24ab09e92231413530f07e5716e02f 100644 (file)
--- a/lib/url.c
+++ b/lib/url.c
@@ -4414,11 +4414,6 @@ CURLcode Curl_done(struct connectdata **connp,
 
   Curl_expire(data, 0); /* stop timer */
 
-  if(conn->bits.done)
-    return CURLE_OK; /* Curl_done() has already been called */
-
-  conn->bits.done = TRUE; /* called just now! */
-
   if(Curl_removeHandleFromPipeline(data, conn->recv_pipe) &&
      conn->readchannel_inuse)
     conn->readchannel_inuse = FALSE;
@@ -4427,6 +4422,16 @@ CURLcode Curl_done(struct connectdata **connp,
     conn->writechannel_inuse = FALSE;
   Curl_removeHandleFromPipeline(data, conn->pend_pipe);
 
+  if(conn->bits.done ||
+     (conn->send_pipe->size + conn->recv_pipe->size != 0 &&
+      !data->set.reuse_forbid &&
+      !conn->bits.close))
+    /* Stop if Curl_done() has already been called or pipeline
+       is not empty and we do not have to close connection. */
+    return CURLE_OK;
+
+  conn->bits.done = TRUE; /* called just now! */
+
   /* Cleanup possible redirect junk */
   if(data->req.newurl) {
     free(data->req.newurl);