React to regression in Http.Sys (#23590)
* React to regression in Http.Sys #23164 * Add granular version check
This commit is contained in:
parent
dae3b46ff7
commit
df5269fea2
|
|
@ -20,6 +20,84 @@ namespace Microsoft.AspNetCore.Server.HttpSys.FunctionalTests
|
|||
{
|
||||
public class Http2Tests
|
||||
{
|
||||
// TODO: Remove when the regression is fixed.
|
||||
// https://github.com/dotnet/aspnetcore/issues/23164#issuecomment-652646163
|
||||
private static readonly Version Win10_Regressed_DataFrame = new Version(10, 0, 20145, 0);
|
||||
|
||||
[ConditionalFact]
|
||||
[MinimumOSVersion(OperatingSystems.Windows, WindowsVersions.Win10, SkipReason = "Http2 requires Win10")]
|
||||
public async Task EmptyResponse_200()
|
||||
{
|
||||
using var server = Utilities.CreateDynamicHttpsServer(out var address, httpContext =>
|
||||
{
|
||||
// Default 200
|
||||
return Task.CompletedTask;
|
||||
});
|
||||
|
||||
await new HostBuilder()
|
||||
.UseHttp2Cat(address, async h2Connection =>
|
||||
{
|
||||
await h2Connection.InitializeConnectionAsync();
|
||||
|
||||
h2Connection.Logger.LogInformation("Initialized http2 connection. Starting stream 1.");
|
||||
|
||||
await h2Connection.StartStreamAsync(1, Http2Utilities.BrowserRequestHeaders, endStream: true);
|
||||
|
||||
await h2Connection.ReceiveHeadersAsync(1, decodedHeaders =>
|
||||
{
|
||||
Assert.Equal("200", decodedHeaders[HeaderNames.Status]);
|
||||
});
|
||||
|
||||
var dataFrame = await h2Connection.ReceiveFrameAsync();
|
||||
if (Environment.OSVersion.Version >= Win10_Regressed_DataFrame)
|
||||
{
|
||||
// TODO: Remove when the regression is fixed.
|
||||
// https://github.com/dotnet/aspnetcore/issues/23164#issuecomment-652646163
|
||||
Http2Utilities.VerifyDataFrame(dataFrame, 1, endOfStream: false, length: 0);
|
||||
|
||||
dataFrame = await h2Connection.ReceiveFrameAsync();
|
||||
}
|
||||
Http2Utilities.VerifyDataFrame(dataFrame, 1, endOfStream: true, length: 0);
|
||||
|
||||
h2Connection.Logger.LogInformation("Connection stopped.");
|
||||
})
|
||||
.Build().RunAsync();
|
||||
}
|
||||
|
||||
[ConditionalFact]
|
||||
[MinimumOSVersion(OperatingSystems.Windows, WindowsVersions.Win10, SkipReason = "Http2 requires Win10")]
|
||||
public async Task ResponseWithData_Success()
|
||||
{
|
||||
using var server = Utilities.CreateDynamicHttpsServer(out var address, httpContext =>
|
||||
{
|
||||
return httpContext.Response.WriteAsync("Hello World");
|
||||
});
|
||||
|
||||
await new HostBuilder()
|
||||
.UseHttp2Cat(address, async h2Connection =>
|
||||
{
|
||||
await h2Connection.InitializeConnectionAsync();
|
||||
|
||||
h2Connection.Logger.LogInformation("Initialized http2 connection. Starting stream 1.");
|
||||
|
||||
await h2Connection.StartStreamAsync(1, Http2Utilities.BrowserRequestHeaders, endStream: true);
|
||||
|
||||
await h2Connection.ReceiveHeadersAsync(1, decodedHeaders =>
|
||||
{
|
||||
Assert.Equal("200", decodedHeaders[HeaderNames.Status]);
|
||||
});
|
||||
|
||||
var dataFrame = await h2Connection.ReceiveFrameAsync();
|
||||
Http2Utilities.VerifyDataFrame(dataFrame, 1, endOfStream: false, length: 11);
|
||||
|
||||
dataFrame = await h2Connection.ReceiveFrameAsync();
|
||||
Http2Utilities.VerifyDataFrame(dataFrame, 1, endOfStream: true, length: 0);
|
||||
|
||||
h2Connection.Logger.LogInformation("Connection stopped.");
|
||||
})
|
||||
.Build().RunAsync();
|
||||
}
|
||||
|
||||
[ConditionalFact(Skip = "https://github.com/dotnet/aspnetcore/issues/17420")]
|
||||
[MinimumOSVersion(OperatingSystems.Windows, WindowsVersions.Win10, SkipReason = "Http2 requires Win10")]
|
||||
[MaximumOSVersion(OperatingSystems.Windows, WindowsVersions.Win10_19H1, SkipReason = "This is last version without GoAway support")]
|
||||
|
|
@ -95,6 +173,14 @@ namespace Microsoft.AspNetCore.Server.HttpSys.FunctionalTests
|
|||
});
|
||||
|
||||
var dataFrame = await h2Connection.ReceiveFrameAsync();
|
||||
if (Environment.OSVersion.Version >= Win10_Regressed_DataFrame)
|
||||
{
|
||||
// TODO: Remove when the regression is fixed.
|
||||
// https://github.com/dotnet/aspnetcore/issues/23164#issuecomment-652646163
|
||||
Http2Utilities.VerifyDataFrame(dataFrame, 1, endOfStream: false, length: 0);
|
||||
|
||||
dataFrame = await h2Connection.ReceiveFrameAsync();
|
||||
}
|
||||
Http2Utilities.VerifyDataFrame(dataFrame, 1, endOfStream: true, length: 0);
|
||||
|
||||
// Http.Sys doesn't send a final GoAway unless we ignore the first one and send 200 additional streams.
|
||||
|
|
@ -135,6 +221,14 @@ namespace Microsoft.AspNetCore.Server.HttpSys.FunctionalTests
|
|||
});
|
||||
|
||||
var dataFrame = await h2Connection.ReceiveFrameAsync();
|
||||
if (Environment.OSVersion.Version >= Win10_Regressed_DataFrame)
|
||||
{
|
||||
// TODO: Remove when the regression is fixed.
|
||||
// https://github.com/dotnet/aspnetcore/issues/23164#issuecomment-652646163
|
||||
Http2Utilities.VerifyDataFrame(dataFrame, 1, endOfStream: false, length: 0);
|
||||
|
||||
dataFrame = await h2Connection.ReceiveFrameAsync();
|
||||
}
|
||||
Http2Utilities.VerifyDataFrame(dataFrame, streamId, endOfStream: true, length: 0);
|
||||
|
||||
// Http.Sys doesn't send a final GoAway unless we ignore the first one and send 200 additional streams.
|
||||
|
|
@ -152,6 +246,14 @@ namespace Microsoft.AspNetCore.Server.HttpSys.FunctionalTests
|
|||
});
|
||||
|
||||
dataFrame = await h2Connection.ReceiveFrameAsync();
|
||||
if (Environment.OSVersion.Version >= Win10_Regressed_DataFrame)
|
||||
{
|
||||
// TODO: Remove when the regression is fixed.
|
||||
// https://github.com/dotnet/aspnetcore/issues/23164#issuecomment-652646163
|
||||
Http2Utilities.VerifyDataFrame(dataFrame, streamId, endOfStream: false, length: 0);
|
||||
|
||||
dataFrame = await h2Connection.ReceiveFrameAsync();
|
||||
}
|
||||
Http2Utilities.VerifyDataFrame(dataFrame, streamId, endOfStream: true, length: 0);
|
||||
}
|
||||
|
||||
|
|
@ -171,6 +273,14 @@ namespace Microsoft.AspNetCore.Server.HttpSys.FunctionalTests
|
|||
});
|
||||
|
||||
dataFrame = await h2Connection.ReceiveFrameAsync();
|
||||
if (Environment.OSVersion.Version >= Win10_Regressed_DataFrame)
|
||||
{
|
||||
// TODO: Remove when the regression is fixed.
|
||||
// https://github.com/dotnet/aspnetcore/issues/23164#issuecomment-652646163
|
||||
Http2Utilities.VerifyDataFrame(dataFrame, streamId, endOfStream: false, length: 0);
|
||||
|
||||
dataFrame = await h2Connection.ReceiveFrameAsync();
|
||||
}
|
||||
Http2Utilities.VerifyDataFrame(dataFrame, streamId, endOfStream: true, length: 0);
|
||||
|
||||
h2Connection.Logger.LogInformation("Connection stopped.");
|
||||
|
|
@ -180,7 +290,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys.FunctionalTests
|
|||
|
||||
[ConditionalFact]
|
||||
[MinimumOSVersion(OperatingSystems.Windows, WindowsVersions.Win10, SkipReason = "Http2 requires Win10")]
|
||||
public async Task AppException_BeforeHeaders_500()
|
||||
public async Task AppException_BeforeResponseHeaders_500()
|
||||
{
|
||||
using var server = Utilities.CreateDynamicHttpsServer(out var address, httpContext =>
|
||||
{
|
||||
|
|
@ -202,6 +312,14 @@ namespace Microsoft.AspNetCore.Server.HttpSys.FunctionalTests
|
|||
});
|
||||
|
||||
var dataFrame = await h2Connection.ReceiveFrameAsync();
|
||||
if (Environment.OSVersion.Version >= Win10_Regressed_DataFrame)
|
||||
{
|
||||
// TODO: Remove when the regression is fixed.
|
||||
// https://github.com/dotnet/aspnetcore/issues/23164#issuecomment-652646163
|
||||
Http2Utilities.VerifyDataFrame(dataFrame, 1, endOfStream: false, length: 0);
|
||||
|
||||
dataFrame = await h2Connection.ReceiveFrameAsync();
|
||||
}
|
||||
Http2Utilities.VerifyDataFrame(dataFrame, 1, endOfStream: true, length: 0);
|
||||
|
||||
h2Connection.Logger.LogInformation("Connection stopped.");
|
||||
|
|
@ -266,8 +384,16 @@ namespace Microsoft.AspNetCore.Server.HttpSys.FunctionalTests
|
|||
Assert.Equal("200", decodedHeaders[HeaderNames.Status]);
|
||||
});
|
||||
|
||||
var resetFrame = await h2Connection.ReceiveFrameAsync();
|
||||
Http2Utilities.VerifyResetFrame(resetFrame, expectedStreamId: 1, Http2ErrorCode.INTERNAL_ERROR);
|
||||
var frame = await h2Connection.ReceiveFrameAsync();
|
||||
if (Environment.OSVersion.Version >= Win10_Regressed_DataFrame)
|
||||
{
|
||||
// TODO: Remove when the regression is fixed.
|
||||
// https://github.com/dotnet/aspnetcore/issues/23164#issuecomment-652646163
|
||||
Http2Utilities.VerifyDataFrame(frame, 1, endOfStream: false, length: 0);
|
||||
|
||||
frame = await h2Connection.ReceiveFrameAsync();
|
||||
}
|
||||
Http2Utilities.VerifyResetFrame(frame, expectedStreamId: 1, Http2ErrorCode.INTERNAL_ERROR);
|
||||
|
||||
h2Connection.Logger.LogInformation("Connection stopped.");
|
||||
})
|
||||
|
|
@ -395,6 +521,9 @@ namespace Microsoft.AspNetCore.Server.HttpSys.FunctionalTests
|
|||
Assert.Equal("200", decodedHeaders[HeaderNames.Status]);
|
||||
});
|
||||
|
||||
var dataFrame = await h2Connection.ReceiveFrameAsync();
|
||||
Http2Utilities.VerifyDataFrame(dataFrame, expectedStreamId: 1, endOfStream: false, length: 0);
|
||||
|
||||
var resetFrame = await h2Connection.ReceiveFrameAsync();
|
||||
Http2Utilities.VerifyResetFrame(resetFrame, expectedStreamId: 1, expectedErrorCode: (Http2ErrorCode)1111);
|
||||
|
||||
|
|
@ -648,6 +777,14 @@ namespace Microsoft.AspNetCore.Server.HttpSys.FunctionalTests
|
|||
});
|
||||
|
||||
var dataFrame = await h2Connection.ReceiveFrameAsync();
|
||||
if (Environment.OSVersion.Version >= Win10_Regressed_DataFrame)
|
||||
{
|
||||
// TODO: Remove when the regression is fixed.
|
||||
// https://github.com/dotnet/aspnetcore/issues/23164#issuecomment-652646163
|
||||
Http2Utilities.VerifyDataFrame(dataFrame, 1, endOfStream: false, length: 0);
|
||||
|
||||
dataFrame = await h2Connection.ReceiveFrameAsync();
|
||||
}
|
||||
Http2Utilities.VerifyDataFrame(dataFrame, 1, endOfStream: true, length: 0);
|
||||
|
||||
var resetFrame = await h2Connection.ReceiveFrameAsync();
|
||||
|
|
|
|||
Loading…
Reference in New Issue