Skip to content

Commit b9ef564

Browse files
rzikmmatouskozak
authored andcommitted
Fix SocketsHttpHandlerTest_HttpClientHandlerTest_Http3.ReadAsStreamAsync_Cancellation data race (dotnet#101428)
* Fix SocketsHttpHandlerTest_HttpClientHandlerTest_Http3.ReadAsStreamAsync_Cancellation data race * Fix build
1 parent ae9529a commit b9ef564

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.cs

+9
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
using System.Linq;
77
using System.Net.Http.Headers;
88
using System.Net.Sockets;
9+
#if !NETFRAMEWORK
10+
using System.Net.Quic;
11+
#endif
912
using System.Net.Test.Common;
1013
using System.Security.Authentication;
1114
using System.Security.Cryptography;
@@ -1396,6 +1399,12 @@ await server.AcceptConnectionAsync(async connection =>
13961399
await connection.SendResponseAsync(HttpStatusCode.OK, headers: new HttpHeaderData[] { new HttpHeaderData("Transfer-Encoding", "chunked") }, isFinal: false);
13971400
await connection.SendResponseBodyAsync("1\r\nh\r\n", false);
13981401
}
1402+
#if !NETFRAMEWORK
1403+
catch (QuicException ex) when (ex.ApplicationErrorCode == 0x10c /*H3_REQUEST_CANCELLED*/)
1404+
{
1405+
// The request was cancelled before we sent the body, ignore
1406+
}
1407+
#endif
13991408
catch (IOException ex)
14001409
{
14011410
// when testing in the browser, we are using the WebSocket for the loopback

0 commit comments

Comments
 (0)