diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/url.c | 6 | ||||
-rw-r--r-- | lib/urldata.h | 4 |
2 files changed, 10 insertions, 0 deletions
@@ -3982,6 +3982,11 @@ CURLcode Curl_done(struct connectdata **connp, struct connectdata *conn = *connp; struct SessionHandle *data=conn->data; + if(conn->bits.done) + return CURLE_OK; /* Curl_done() has already been called */ + + conn->bits.done = TRUE; /* called just now! */ + /* cleanups done even if the connection is re-used */ if(conn->bits.rangestringalloc) { free(conn->range); @@ -4047,6 +4052,7 @@ CURLcode Curl_do(struct connectdata **connp, bool *done) struct connectdata *conn = *connp; struct SessionHandle *data=conn->data; + conn->bits.done = FALSE; /* Curl_done() is not called yet */ conn->bits.do_more = FALSE; /* by default there's no curl_do_more() to use */ if(conn->curl_do) { diff --git a/lib/urldata.h b/lib/urldata.h index a3802b7c3..6cb3729b9 100644 --- a/lib/urldata.h +++ b/lib/urldata.h @@ -432,6 +432,10 @@ struct ConnectBits { bool trailerHdrPresent; /* Set when Trailer: header found in HTTP response. Required to determine whether to look for trailers in case of Transfer-Encoding: chunking */ + bool done; /* set to FALSE when Curl_do() is called and set to TRUE + when Curl_done() is called, to prevent Curl_done() to + get invoked twice when the multi interface is + used. */ }; struct hostname { |