using Microsoft.AspNetCore.Connections;
using Microsoft.AspNetCore.Http.Features;
using System.Threading.Tasks;
namespace FastGithub.HttpServer.TlsMiddlewares
{
///
/// https恢复中间件
///
sealed class TlsRestoreMiddleware
{
///
/// 执行中间件
///
///
///
public async Task InvokeAsync(ConnectionDelegate next, ConnectionContext context)
{
if (context.Features.Get() == FakeTlsConnectionFeature.Instance)
{
// 擦除入侵
context.Features.Set(null);
}
await next(context);
}
}
}