Skip to content

Commit

Permalink
[QUIC] Update to msquic 2 (#67383)
Browse files Browse the repository at this point in the history
* Update to msquic 2, test and code fixes

* feedback

* Fixed more HTTP/3 bugs

* updated fedora image to contain the newest msquic

* Better test debugging, fixed some timeouts

* feedback

* Return some msquic calls into a lock
  • Loading branch information
ManickaP committed Apr 1, 2022
1 parent f249a3d commit d5b1a7f
Show file tree
Hide file tree
Showing 21 changed files with 345 additions and 190 deletions.
2 changes: 1 addition & 1 deletion eng/pipelines/coreclr/templates/helix-queues-setup.yml
Expand Up @@ -100,7 +100,7 @@ jobs:
- (Debian.11.Amd64)Ubuntu.1804.amd64@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-11-helix-amd64-20210304164428-5a7c380
- Ubuntu.1804.Amd64
- (Centos.8.Amd64)Ubuntu.1604.amd64@mcr.microsoft.com/dotnet-buildtools/prereqs:centos-8-helix-20201229003624-c1bf759
- (Fedora.34.Amd64)Ubuntu.1604.amd64@mcr.microsoft.com/dotnet-buildtools/prereqs:fedora-34-helix-20210728124700-4f64125
- (Fedora.34.Amd64)Ubuntu.1604.amd64@mcr.microsoft.com/dotnet-buildtools/prereqs:fedora-34-helix-20220331150839-4f64125
- RedHat.7.Amd64

# OSX arm64
Expand Down
4 changes: 2 additions & 2 deletions eng/pipelines/libraries/helix-queues-setup.yml
Expand Up @@ -64,14 +64,14 @@ jobs:
- (Centos.8.Amd64.Open)Ubuntu.1804.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:centos-8-helix-20201229003624-c1bf759
- RedHat.7.Amd64.Open
- SLES.15.Amd64.Open
- (Fedora.34.Amd64.Open)Ubuntu.1804.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:fedora-34-helix-20210913123654-4f64125
- (Fedora.34.Amd64.Open)Ubuntu.1804.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:fedora-34-helix-20220331150839-4f64125
- (Ubuntu.2110.Amd64.Open)Ubuntu.1804.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-21.10-helix-amd64-20211116135132-0f8d97e
- (Debian.10.Amd64.Open)Ubuntu.1804.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-10-helix-amd64-bfcd90a-20200121150006
- ${{ if or(ne(parameters.jobParameters.testScope, 'outerloop'), ne(parameters.jobParameters.runtimeFlavor, 'mono')) }}:
- ${{ if or(eq(parameters.jobParameters.isExtraPlatforms, true), eq(parameters.jobParameters.includeAllPlatforms, true)) }}:
- (Centos.8.Amd64.Open)Ubuntu.1604.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:centos-8-helix-20201229003624-c1bf759
- SLES.15.Amd64.Open
- (Fedora.34.Amd64.Open)ubuntu.1604.amd64.open@mcr.microsoft.com/dotnet-buildtools/prereqs:fedora-34-helix-20210913123654-4f64125
- (Fedora.34.Amd64.Open)ubuntu.1604.amd64.open@mcr.microsoft.com/dotnet-buildtools/prereqs:fedora-34-helix-20220331150839-4f64125
- (Ubuntu.2110.Amd64.Open)ubuntu.1604.amd64.open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-21.04-helix-amd64-20210922170909-34a2d72
- (Debian.11.Amd64.Open)Ubuntu.1804.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-11-helix-amd64-20210304164428-5a7c380
- (Mariner.1.0.Amd64.Open)ubuntu.1604.amd64.open@mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-1.0-helix-20210528192219-92bf620
Expand Down
Expand Up @@ -78,7 +78,10 @@ public async Task PostAsync_CancelDuringRequestContentSend_TaskCanceledQuickly(b
{
await server.AcceptConnectionAsync(connection => serverRelease.Task);
}
catch { }; // Ignore any closing errors since we did not really process anything.
catch (Exception ex)
{
_output.WriteLine($"Ignored exception:{Environment.NewLine}{ex}");
}
});
}

Expand Down Expand Up @@ -131,7 +134,11 @@ public async Task GetAsync_CancelDuringResponseHeadersReceived_TaskCanceledQuick
{
clientFinished.SetResult(true);
await serverTask;
} catch { }
}
catch (Exception ex)
{
_output.WriteLine($"Ignored exception:{Environment.NewLine}{ex}");
}
});
}
}
Expand Down Expand Up @@ -188,7 +195,11 @@ public async Task GetAsync_CancelDuringResponseBodyReceived_Buffered_TaskCancele
{
clientFinished.SetResult(true);
await serverTask;
} catch { }
}
catch (Exception ex)
{
_output.WriteLine($"Ignored exception:{Environment.NewLine}{ex}");
}
});
}
}
Expand Down Expand Up @@ -264,7 +275,11 @@ public async Task GetAsync_CancelDuringResponseBodyReceived_Unbuffered_TaskCance
{
clientFinished.SetResult(true);
await serverTask;
} catch { }
}
catch (Exception ex)
{
_output.WriteLine($"Ignored exception:{Environment.NewLine}{ex}");
}
});
}
}
Expand Down
Expand Up @@ -90,7 +90,10 @@ public async Task InfiniteSingleHeader_ThrowsException()
await Task.Delay(1);
}
}
catch { }
catch (Exception ex)
{
_output.WriteLine($"Ignored exception:{Environment.NewLine}{ex}");
}
});
Exception e = await Assert.ThrowsAsync<HttpRequestException>(() => getAsync);
Expand Down Expand Up @@ -136,7 +139,14 @@ public async Task ThresholdExceeded_ThrowsException(string responseHeaders, int?
{
Assert.Contains((handler.MaxResponseHeadersLength * 1024).ToString(), e.ToString());
}
try { await serverTask; } catch { }
try
{
await serverTask;
}
catch (Exception ex)
{
_output.WriteLine($"Ignored exception:{Environment.NewLine}{ex}");
}
}
});
}
Expand Down
Expand Up @@ -341,7 +341,7 @@ public async Task ProxyTunnelRequest_GetAsync_Success()
await LoopbackServer.CreateServerAsync(async (server, uri) =>
{
Assert.Equal(proxyServer.Uri, handler.Proxy.GetProxy(uri));
Task<HttpResponseMessage> clientTask = client.GetAsync(uri);
await server.AcceptConnectionSendResponseAndCloseAsync(content: Content);
using (var response = await clientTask)
Expand Down Expand Up @@ -578,7 +578,14 @@ public async Task ProxiedIPAddressRequest_NotDefaultPort_CorrectlyFormatted(stri
using (HttpClient client = CreateHttpClient(handler))
{
handler.Proxy = new WebProxy(proxyUri);
try { await client.GetAsync(uri); } catch { }
try
{
await client.GetAsync(uri);
}
catch (Exception ex)
{
_output.WriteLine($"Ignored exception:{Environment.NewLine}{ex}");
}
}
}, server => server.AcceptConnectionAsync(async connection =>
{
Expand Down Expand Up @@ -611,7 +618,14 @@ public async Task ProxiedRequest_DefaultPort_PortStrippedOffInUri(string host)
using (HttpClient client = CreateHttpClient(handler))
{
handler.Proxy = new WebProxy(proxyUri);
try { await client.GetAsync(addressUri); } catch { }
try
{
await client.GetAsync(addressUri);
}
catch (Exception ex)
{
_output.WriteLine($"Ignored exception:{Environment.NewLine}{ex}");
}
}
}, server => server.AcceptConnectionAsync(async connection =>
{
Expand Down Expand Up @@ -639,7 +653,14 @@ public async Task ProxyTunnelRequest_PortSpecified_NotStrippedOffInUri(string ho
{
handler.Proxy = new WebProxy(proxyUri);
handler.ServerCertificateCustomValidationCallback = TestHelper.AllowAllCertificates;
try { await client.GetAsync(addressUri); } catch { }
try
{
await client.GetAsync(addressUri);
}
catch (Exception ex)
{
_output.WriteLine($"Ignored exception:{Environment.NewLine}{ex}");
}
}
}, server => server.AcceptConnectionAsync(async connection =>
{
Expand Down
42 changes: 31 additions & 11 deletions src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.cs
Expand Up @@ -248,7 +248,14 @@ public async Task GetAsync_IPv6AddressInHostHeader_CorrectlyFormatted(string hos
using (HttpClient client = CreateHttpClient(handler))
{
handler.Proxy = new WebProxy(proxyUri);
try { await client.GetAsync(ipv6Address); } catch { }
try
{
await client.GetAsync(ipv6Address);
}
catch (Exception ex)
{
_output.WriteLine($"Ignored exception:{Environment.NewLine}{ex}");
}
}
}, server => server.AcceptConnectionAsync(async connection =>
{
Expand Down Expand Up @@ -292,7 +299,14 @@ public async Task GetAsync_SecureAndNonSecureIPBasedUri_CorrectlyFormatted(IPAdd
// we could not create SslStream in browser, [ActiveIssue("https://github.com/dotnet/runtime/issues/37669", TestPlatforms.Browser)]
handler.ServerCertificateCustomValidationCallback = TestHelper.AllowAllCertificates;
}
try { await client.GetAsync(url); } catch { }
try
{
await client.GetAsync(url);
}
catch (Exception ex)
{
_output.WriteLine($"Ignored exception:{Environment.NewLine}{ex}");
}
}
}, server => server.AcceptConnectionAsync(async connection =>
{
Expand Down Expand Up @@ -449,7 +463,7 @@ public async Task PostAsync_ManyDifferentRequestHeaders_SentCorrectly()
request.Headers.Referrer = new Uri("http://en.wikipedia.org/wiki/Main_Page");
request.Headers.TE.Add(new TransferCodingWithQualityHeaderValue("trailers"));
request.Headers.TE.Add(new TransferCodingWithQualityHeaderValue("deflate"));
if (PlatformDetection.IsNotNodeJS)
if (PlatformDetection.IsNotNodeJS)
{
request.Headers.Trailer.Add("MyTrailer");
request.Headers.TransferEncoding.Add(new TransferCodingHeaderValue("chunked"));
Expand All @@ -468,7 +482,7 @@ public async Task PostAsync_ManyDifferentRequestHeaders_SentCorrectly()
request.Headers.Add("X-Requested-With", "XMLHttpRequest");
request.Headers.Add("DNT", "1 (Do Not Track Enabled)");
request.Headers.Add("X-Forwarded-For", "client1");
if (PlatformDetection.IsNotNodeJS)
if (PlatformDetection.IsNotNodeJS)
{
request.Headers.Add("X-Forwarded-For", "proxy1");
request.Headers.Add("X-Forwarded-For", "proxy2");
Expand All @@ -483,7 +497,7 @@ public async Task PostAsync_ManyDifferentRequestHeaders_SentCorrectly()
request.Headers.Add("X-UIDH", "...");
request.Headers.Add("X-Csrf-Token", "i8XNjC4b8KVok4uw5RftR38Wgp2BFwql");
request.Headers.Add("X-Request-ID", "f058ebd6-02f7-4d3f-942e-904344e8cde5");
if (PlatformDetection.IsNotNodeJS)
if (PlatformDetection.IsNotNodeJS)
{
request.Headers.Add("X-Request-ID", "f058ebd6-02f7-4d3f-942e-904344e8cde5");
}
Expand Down Expand Up @@ -524,7 +538,7 @@ public async Task PostAsync_ManyDifferentRequestHeaders_SentCorrectly()
Assert.Equal($"Basic {authSafeValue}", requestData.GetSingleHeaderValue("Proxy-Authorization"));
Assert.Equal("Mozilla/5.0", requestData.GetSingleHeaderValue("User-Agent"));
Assert.Equal("http://en.wikipedia.org/wiki/Main_Page", requestData.GetSingleHeaderValue("Referer"));
if (PlatformDetection.IsNotNodeJS)
if (PlatformDetection.IsNotNodeJS)
{
Assert.Equal("MyTrailer", requestData.GetSingleHeaderValue("Trailer"));
}
Expand All @@ -543,7 +557,7 @@ public async Task PostAsync_ManyDifferentRequestHeaders_SentCorrectly()
Assert.Equal("bytes=500-999", requestData.GetSingleHeaderValue("Range"));
Assert.Equal("199 - \"Miscellaneous warning\"", requestData.GetSingleHeaderValue("Warning"));
Assert.Equal("XMLHttpRequest", requestData.GetSingleHeaderValue("X-Requested-With"));
if (PlatformDetection.IsNotNodeJS)
if (PlatformDetection.IsNotNodeJS)
{
Assert.Equal("client1, proxy1, proxy2", requestData.GetSingleHeaderValue("X-Forwarded-For"));
}
Expand All @@ -560,11 +574,11 @@ public async Task PostAsync_ManyDifferentRequestHeaders_SentCorrectly()
Assert.Equal("http://wap.samsungmobile.com/uaprof/SGH-I777.xml", requestData.GetSingleHeaderValue("X-Wap-Profile"));
Assert.Equal("...", requestData.GetSingleHeaderValue("X-UIDH"));
Assert.Equal("i8XNjC4b8KVok4uw5RftR38Wgp2BFwql", requestData.GetSingleHeaderValue("X-Csrf-Token"));
if (PlatformDetection.IsNotNodeJS)
if (PlatformDetection.IsNotNodeJS)
{
Assert.Equal("f058ebd6-02f7-4d3f-942e-904344e8cde5, f058ebd6-02f7-4d3f-942e-904344e8cde5", requestData.GetSingleHeaderValue("X-Request-ID"));
}
else
else
{
// node-fetch polyfill doesn't support combining multiple header values
Assert.Equal("f058ebd6-02f7-4d3f-942e-904344e8cde5", requestData.GetSingleHeaderValue("X-Request-ID"));
Expand Down Expand Up @@ -892,7 +906,10 @@ public async Task GetAsync_InfiniteChunkSize_ThrowsHttpRequestException()
await Task.Delay(1);
}
}
catch { }
catch (Exception ex)
{
_output.WriteLine($"Ignored exception:{Environment.NewLine}{ex}");
}
});
await Assert.ThrowsAsync<HttpRequestException>(() => client.GetAsync(url));
Expand Down Expand Up @@ -1660,7 +1677,10 @@ public async Task SendAsync_Expect100Continue_RequestBodyFails_ThrowsContentExce
{
await connection.ReadRequestDataAsync(readBody: true);
}
catch { } // Eat errors from client disconnect.
catch (Exception ex)
{
_output.WriteLine($"Ignored exception:{Environment.NewLine}{ex}");
}
await clientFinished.Task.WaitAsync(TimeSpan.FromMinutes(2));
});
});
Expand Down
Expand Up @@ -128,7 +128,7 @@ public async Task SendAsync_GetUsingChunkedEncoding_ThrowsHttpRequestException()
using (HttpClient client = new HttpClient(handler))
{
HttpRequestException ex = await Assert.ThrowsAsync<HttpRequestException>(() => client.SendAsync(request));
_output.WriteLine(ex.ToString());
_output.WriteLine($"Ignored exception:{Environment.NewLine}{ex}");
}
}

Expand Down Expand Up @@ -236,7 +236,7 @@ public async Task SendAsync_UseTcpKeepAliveOptions()
_output.WriteLine(responseContent);

// Uncomment this to observe an exchange of "TCP Keep-Alive" and "TCP Keep-Alive ACK" packets:
// await Task.Delay(5000);
// await Task.Delay(5000);
}

private async Task VerifyResponse(Task<HttpResponseMessage> task, string payloadText)
Expand Down
Expand Up @@ -204,7 +204,7 @@ public async Task Http2ClearText_SendAsync_Success(string clientContent, string
Http2LoopbackConnection connection = await server.EstablishConnectionAsync();
Assert.IsNotType<SslStream>(connection.Stream);
HttpRequestData requestData = await connection.ReadRequestDataAsync();
HttpRequestData requestData = await connection.ReadRequestDataAsync();
string requestContent = requestData.Body is null ? (string)null : Encoding.ASCII.GetString(requestData.Body);
Assert.Equal(clientContent, requestContent);
await connection.SendResponseAsync(HttpStatusCode.OK, content: serverContent);
Expand Down Expand Up @@ -3164,7 +3164,10 @@ public async Task SendAsync_ConcurentSendReceive_Fail()
await connection.SendGoAway(streamId);
await connection.WaitForConnectionShutdownAsync();
}
catch { };
catch (Exception ex)
{
_output.WriteLine($"Ignored exception:{Environment.NewLine}{ex}");
}
});
}

Expand Down
Expand Up @@ -278,7 +278,6 @@ public async Task SendMoreThanStreamLimitRequestsConcurrently_LastWaits(int stre
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/53090")]
public async Task ReservedFrameType_Throws()
{
const int ReservedHttp2PriorityFrameId = 0x2;
Expand Down Expand Up @@ -1138,7 +1137,7 @@ public async Task RequestContentStreaming_Timeout_BothClientAndServerReceiveCanc
await requestStream.WriteAsync(message);
await requestStream.FlushAsync();
await Task.Delay(TimeSpan.FromSeconds(11)); // longer than client.Timeout
// Http3WriteStream is disposed after cancellation fired
Expand Down Expand Up @@ -1208,7 +1207,7 @@ public async Task RequestContentStreaming_Cancellation_BothClientAndServerReceiv
await requestStream.WriteAsync(message);
await requestStream.FlushAsync();
cts.Cancel();
await Task.Delay(250);
Expand Down Expand Up @@ -1291,7 +1290,7 @@ public async Task DuplexStreaming_RequestCTCancellation_DoesNotApply()
await requestStream.WriteAsync(message);
await requestStream.FlushAsync();
// cancelling after SendAsync finished should not apply -- nothing should happen
cts.Cancel();
await Task.Delay(250);
Expand Down

0 comments on commit d5b1a7f

Please sign in to comment.