From 1b4b548febd206b2c344a01dc321879fbb27747a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 17 Feb 2026 15:44:58 +0000 Subject: [PATCH 1/3] Initial plan From de2c9d83f27fced9ce004352c3afd7498a2879a4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 17 Feb 2026 15:50:21 +0000 Subject: [PATCH 2/3] Fix ThresholdExceeded_ThrowsException test to handle ConnectionReset and ConnectionAborted Co-authored-by: MihaZupan <25307628+MihaZupan@users.noreply.github.com> --- .../Http/HttpClientHandlerTest.MaxResponseHeadersLength.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.MaxResponseHeadersLength.cs b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.MaxResponseHeadersLength.cs index 7fee0affc047c3..80c9e69bc2adb3 100644 --- a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.MaxResponseHeadersLength.cs +++ b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.MaxResponseHeadersLength.cs @@ -100,7 +100,7 @@ await LoopbackServerFactory.CreateClientAndServerAsync(async uri => await connection.SendResponseAsync(headers: new[] { new HttpHeaderData("Foo", new string('a', handler.MaxResponseHeadersLength * 1024)) }); } // Client can respond by closing/aborting the underlying stream while we are still sending the headers, ignore these exceptions - catch (IOException ex) when (ex.InnerException is SocketException se && se.SocketErrorCode == SocketError.Shutdown) { } + catch (IOException ex) when (ex.InnerException is SocketException se && (se.SocketErrorCode == SocketError.Shutdown || se.SocketErrorCode == SocketError.ConnectionReset || se.SocketErrorCode == SocketError.ConnectionAborted)) { } #if !WINHTTPHANDLER_TEST catch (QuicException ex) when (ex.QuicError == QuicError.StreamAborted && ex.ApplicationErrorCode == Http3ExcessiveLoad) { } #endif @@ -165,7 +165,7 @@ await LoopbackServerFactory.CreateClientAndServerAsync(async uri => await connection.SendResponseAsync(headers: headers); } // Client can respond by closing/aborting the underlying stream while we are still sending the headers, ignore these exceptions - catch (IOException ex) when (ex.InnerException is SocketException se && se.SocketErrorCode == SocketError.Shutdown) { } + catch (IOException ex) when (ex.InnerException is SocketException se && (se.SocketErrorCode == SocketError.Shutdown || se.SocketErrorCode == SocketError.ConnectionReset || se.SocketErrorCode == SocketError.ConnectionAborted)) { } #if !WINHTTPHANDLER_TEST catch (QuicException ex) when (ex.QuicError == QuicError.StreamAborted && ex.ApplicationErrorCode == Http3ExcessiveLoad) {} #endif From ca99a1e09270fa793835b44680aa9f2b57ac86bb Mon Sep 17 00:00:00 2001 From: Miha Zupan Date: Tue, 17 Feb 2026 16:57:03 +0100 Subject: [PATCH 3/3] Use pattern matching --- .../Http/HttpClientHandlerTest.MaxResponseHeadersLength.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.MaxResponseHeadersLength.cs b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.MaxResponseHeadersLength.cs index 80c9e69bc2adb3..0d9b82b491d38d 100644 --- a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.MaxResponseHeadersLength.cs +++ b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.MaxResponseHeadersLength.cs @@ -100,7 +100,7 @@ await LoopbackServerFactory.CreateClientAndServerAsync(async uri => await connection.SendResponseAsync(headers: new[] { new HttpHeaderData("Foo", new string('a', handler.MaxResponseHeadersLength * 1024)) }); } // Client can respond by closing/aborting the underlying stream while we are still sending the headers, ignore these exceptions - catch (IOException ex) when (ex.InnerException is SocketException se && (se.SocketErrorCode == SocketError.Shutdown || se.SocketErrorCode == SocketError.ConnectionReset || se.SocketErrorCode == SocketError.ConnectionAborted)) { } + catch (IOException ex) when (ex.InnerException is SocketException se && se.SocketErrorCode is SocketError.Shutdown or SocketError.ConnectionReset or SocketError.ConnectionAborted) { } #if !WINHTTPHANDLER_TEST catch (QuicException ex) when (ex.QuicError == QuicError.StreamAborted && ex.ApplicationErrorCode == Http3ExcessiveLoad) { } #endif @@ -165,7 +165,7 @@ await LoopbackServerFactory.CreateClientAndServerAsync(async uri => await connection.SendResponseAsync(headers: headers); } // Client can respond by closing/aborting the underlying stream while we are still sending the headers, ignore these exceptions - catch (IOException ex) when (ex.InnerException is SocketException se && (se.SocketErrorCode == SocketError.Shutdown || se.SocketErrorCode == SocketError.ConnectionReset || se.SocketErrorCode == SocketError.ConnectionAborted)) { } + catch (IOException ex) when (ex.InnerException is SocketException se && se.SocketErrorCode is SocketError.Shutdown or SocketError.ConnectionReset or SocketError.ConnectionAborted) { } #if !WINHTTPHANDLER_TEST catch (QuicException ex) when (ex.QuicError == QuicError.StreamAborted && ex.ApplicationErrorCode == Http3ExcessiveLoad) {} #endif