ITlsHandshakeFeature requires Win8+ (#7629)
This commit is contained in:
parent
60b00fa007
commit
191fb03de7
|
|
@ -20,8 +20,6 @@ namespace Microsoft.AspNetCore.Server.HttpSys
|
||||||
{ typeof(IHttpResponseFeature), _identityFunc },
|
{ typeof(IHttpResponseFeature), _identityFunc },
|
||||||
{ typeof(IHttpSendFileFeature), _identityFunc },
|
{ typeof(IHttpSendFileFeature), _identityFunc },
|
||||||
{ typeof(ITlsConnectionFeature), ctx => ctx.GetTlsConnectionFeature() },
|
{ 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(IHttpBufferingFeature), _identityFunc },
|
||||||
{ typeof(IHttpRequestLifetimeFeature), _identityFunc },
|
{ typeof(IHttpRequestLifetimeFeature), _identityFunc },
|
||||||
{ typeof(IHttpAuthenticationFeature), _identityFunc },
|
{ typeof(IHttpAuthenticationFeature), _identityFunc },
|
||||||
|
|
@ -41,6 +39,8 @@ namespace Microsoft.AspNetCore.Server.HttpSys
|
||||||
// SignalR uses the presence of the feature to detect feature support.
|
// SignalR uses the presence of the feature to detect feature support.
|
||||||
// https://github.com/aspnet/HttpSysServer/issues/427
|
// https://github.com/aspnet/HttpSysServer/issues/427
|
||||||
_featureFuncLookup[typeof(IHttpUpgradeFeature)] = _identityFunc;
|
_featureFuncLookup[typeof(IHttpUpgradeFeature)] = _identityFunc;
|
||||||
|
// Win8+
|
||||||
|
_featureFuncLookup[typeof(ITlsHandshakeFeature)] = ctx => ctx.GetTlsHandshakeFeature();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -102,9 +102,32 @@ namespace Microsoft.AspNetCore.Server.HttpSys
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConditionalFact]
|
[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()
|
public async Task Https_SetsITlsHandshakeFeature()
|
||||||
{
|
{
|
||||||
using (Utilities.CreateDynamicHttpsServer(out var address, httpContext =>
|
using (Utilities.CreateDynamicHttpsServer(out var address, async httpContext =>
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -121,9 +144,8 @@ namespace Microsoft.AspNetCore.Server.HttpSys
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
return httpContext.Response.WriteAsync(ex.ToString());
|
await httpContext.Response.WriteAsync(ex.ToString());
|
||||||
}
|
}
|
||||||
return Task.FromResult(0);
|
|
||||||
}))
|
}))
|
||||||
{
|
{
|
||||||
string response = await SendRequestAsync(address);
|
string response = await SendRequestAsync(address);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue