From 728f8d3bdc336e3fa838f45cad6c0133a6b604ae Mon Sep 17 00:00:00 2001 From: Chris Paulson-Ellis Date: Sat, 29 Aug 2020 18:26:50 +0100 Subject: [PATCH] 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 --- lib/url.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/url.c b/lib/url.c index 48b08d7fcd..8a7114a238 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); -- 2.47.3