ITlsHandshakeFeature requires Win8+ (#7629)

This commit is contained in:
Chris Ross 2019-02-15 16:28:04 -08:00 committed by GitHub
parent 60b00fa007
commit 191fb03de7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 5 deletions

View File

@ -20,8 +20,6 @@ namespace Microsoft.AspNetCore.Server.HttpSys
{ typeof(IHttpResponseFeature), _identityFunc },
{ typeof(IHttpSendFileFeature), _identityFunc },
{ typeof(ITlsConnectionFeature), ctx => ctx.GetTlsConnectionFeature() },
{ typeof(ITlsHandshakeFeature), ctx => ctx.GetTlsHandshakeFeature() },
// { typeof(ITlsTokenBindingFeature), ctx => ctx.GetTlsTokenBindingFeature() }, TODO: https://github.com/aspnet/HttpSysServer/issues/231
{ typeof(IHttpBufferingFeature), _identityFunc },
{ typeof(IHttpRequestLifetimeFeature), _identityFunc },
{ typeof(IHttpAuthenticationFeature), _identityFunc },
@ -41,6 +39,8 @@ namespace Microsoft.AspNetCore.Server.HttpSys
// SignalR uses the presence of the feature to detect feature support.
// https://github.com/aspnet/HttpSysServer/issues/427
_featureFuncLookup[typeof(IHttpUpgradeFeature)] = _identityFunc;
// Win8+
_featureFuncLookup[typeof(ITlsHandshakeFeature)] = ctx => ctx.GetTlsHandshakeFeature();
}
}

View File

@ -102,9 +102,32 @@ namespace Microsoft.AspNetCore.Server.HttpSys
}
[ConditionalFact]
[OSDontSkipCondition(OperatingSystems.Windows, WindowsVersions.Win7, WindowsVersions.Win2008R2)]
public async Task Https_SkipsITlsHandshakeFeatureOnWin7()
{
using (Utilities.CreateDynamicHttpsServer(out var address, async httpContext =>
{
try
{
var tlsFeature = httpContext.Features.Get<ITlsHandshakeFeature>();
Assert.Null(tlsFeature);
}
catch (Exception ex)
{
await httpContext.Response.WriteAsync(ex.ToString());
}
}))
{
string response = await SendRequestAsync(address);
Assert.Equal(string.Empty, response);
}
}
[ConditionalFact]
[OSSkipCondition(OperatingSystems.Windows, WindowsVersions.Win7, WindowsVersions.Win2008R2)]
public async Task Https_SetsITlsHandshakeFeature()
{
using (Utilities.CreateDynamicHttpsServer(out var address, httpContext =>
using (Utilities.CreateDynamicHttpsServer(out var address, async httpContext =>
{
try
{
@ -121,9 +144,8 @@ namespace Microsoft.AspNetCore.Server.HttpSys
}
catch (Exception ex)
{
return httpContext.Response.WriteAsync(ex.ToString());
await httpContext.Response.WriteAsync(ex.ToString());
}
return Task.FromResult(0);
}))
{
string response = await SendRequestAsync(address);