]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
conn: check for connection being dead before reuse
authorChris Paulson-Ellis <chris@paulson-ellis.org>
Sat, 29 Aug 2020 17:26:50 +0000 (18:26 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Sun, 30 Aug 2020 14:59:16 +0000 (16:59 +0200)
Prevents incorrect reuse of an HTTP connection that has been prematurely
shutdown() by the server.

Partial revert of 755083d00deb16

Fixes #5884
Closes #5893

lib/url.c

index 48b08d7fcd66b71b653d2f66d5f2aa1e56bdb7f0..8a7114a23852e45527dee0e7cd0aa90cced54b5b 100644 (file)
--- 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);