From: Daniel Stenberg Date: Fri, 6 May 2022 08:00:24 +0000 (+0200) Subject: http_proxy/hyper: handle closed connections X-Git-Tag: curl-7_83_1~21 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a8a1dd8ecc1e853953e7dcbca282c60454ffaaec;p=thirdparty%2Fcurl.git http_proxy/hyper: handle closed connections Enable test 1021 for hyper builds. Patched-by: Prithvi MK Fixes #8700 Closes #8806 --- diff --git a/lib/http_proxy.c b/lib/http_proxy.c index 863cbbbdce..ed08193e1e 100644 --- a/lib/http_proxy.c +++ b/lib/http_proxy.c @@ -967,6 +967,13 @@ static CURLcode CONNECT(struct Curl_easy *data, break; } + if(conn->bits.close && data->req.newurl) { + /* Connection closed by server. Don't use it anymore */ + Curl_closesocket(data, conn, conn->sock[sockindex]); + conn->sock[sockindex] = CURL_SOCKET_BAD; + break; + } + /* If we are supposed to continue and request a new URL, which basically * means the HTTP authentication is still going on so if the tunnel * is complete we start over in INIT state */ diff --git a/tests/data/DISABLED b/tests/data/DISABLED index efdfeefc82..453a0ecebe 100644 --- a/tests/data/DISABLED +++ b/tests/data/DISABLED @@ -50,7 +50,6 @@ 671 672 673 -1021 1417 1533 1540 diff --git a/tests/data/test1021 b/tests/data/test1021 index 9afe95f4bb..59901cae0a 100644 --- a/tests/data/test1021 +++ b/tests/data/test1021 @@ -17,7 +17,7 @@ HTTP/1.1 407 Authorization Required to proxy me my dear swsclose Proxy-Authenticate: NTLM Content-Length: 16 Connection: close - + data to discard @@ -26,7 +26,7 @@ data to discard HTTP/1.1 407 Authorization Required to proxy me my dear Proxy-Authenticate: NTLM TlRMTVNTUAACAAAAAgACADAAAACGggEAc51AYVDgyNcAAAAAAAAAAG4AbgAyAAAAQ0MCAAQAQwBDAAEAEgBFAEwASQBTAEEAQgBFAFQASAAEABgAYwBjAC4AaQBjAGUAZABlAHYALgBuAHUAAwAsAGUAbABpAHMAYQBiAGUAdABoAC4AYwBjAC4AaQBjAGUAZABlAHYALgBuAHUAAAAAAA== Content-Length: 28 - + 27 bytes and newline to ign @@ -64,11 +64,11 @@ HTTP/1.1 407 Authorization Required to proxy me my dear swsclose Proxy-Authenticate: NTLM Content-Length: 16 Connection: close - + HTTP/1.1 407 Authorization Required to proxy me my dear Proxy-Authenticate: NTLM TlRMTVNTUAACAAAAAgACADAAAACGggEAc51AYVDgyNcAAAAAAAAAAG4AbgAyAAAAQ0MCAAQAQwBDAAEAEgBFAEwASQBTAEEAQgBFAFQASAAEABgAYwBjAC4AaQBjAGUAZABlAHYALgBuAHUAAwAsAGUAbABpAHMAYQBiAGUAdABoAC4AYwBjAC4AaQBjAGUAZABlAHYALgBuAHUAAAAAAA== Content-Length: 28 - + HTTP/1.1 200 Things are fine in proxy land Server: Microsoft-IIS/5.0 Content-Type: text/html; charset=iso-8859-1