aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2008-01-29 12:58:25 +0000
committerDaniel Stenberg <daniel@haxx.se>2008-01-29 12:58:25 +0000
commit1bfbd250272d019949c89e48bfbeb7cd00d20029 (patch)
tree5f831e6edb5a0f0974c6fb7dc69c314a6ecc708f /lib
parentceb5a8ca7bc340ea14588fc145a653fbf0d1dc2a (diff)
- Dmitry Kurochkin fixed Curl_done() for pipelining, as it could previously
crash!
Diffstat (limited to 'lib')
-rw-r--r--lib/url.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/url.c b/lib/url.c
index 5a47e289a..4fab64486 100644
--- 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);