summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Paulson-Ellis <chris@paulson-ellis.org>2020-08-29 18:26:50 +0100
committerDaniel Stenberg <daniel@haxx.se>2020-08-30 16:59:16 +0200
commit728f8d3bdc336e3fa838f45cad6c0133a6b604ae (patch)
tree50206e2bcbb1ae7f994680e596363ce3a49634e4
parent8b69ac0c10e8c718e97c3e0465629a77d499aace (diff)
downloadcurl-728f8d3bdc336e3fa838f45cad6c0133a6b604ae.tar.gz
conn: check for connection being dead before reuse
Prevents incorrect reuse of an HTTP connection that has been prematurely shutdown() by the server. Partial revert of 755083d00deb16 Fixes #5884 Closes #5893
-rw-r--r--lib/url.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/url.c b/lib/url.c
index 48b08d7fc..8a7114a23 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -1120,6 +1120,12 @@ ConnectionExists(struct Curl_easy *data,
/* connect-only or to-be-closed connections will not be reused */
continue;
+ if(extract_if_dead(check, data)) {
+ /* disconnect it */
+ (void)Curl_disconnect(data, check, /* dead_connection */TRUE);
+ continue;
+ }
+
if(bundle->multiuse == BUNDLE_MULTIPLEX)
multiplexed = CONN_INUSE(check);