null检测

This commit is contained in:
陈国伟 2021-10-25 14:22:03 +08:00
parent 8786e97201
commit 33197ec838
3 changed files with 11 additions and 6 deletions

View File

@ -1,12 +1,13 @@
<Project>
<PropertyGroup>
<Version>2.0.4</Version>
<Version>2.0.5</Version>
<Nullable>enable</Nullable>
<Description>github加速神器</Description>
<Copyright>https://github.com/dotnetcore/FastGithub</Copyright>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<DisableImplicitNamespaceImports>true</DisableImplicitNamespaceImports>
<EnableCompressionInSingleFile>true</EnableCompressionInSingleFile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'">

View File

@ -88,8 +88,12 @@ namespace FastGithub.HttpServer
using var targetSocket = new Socket(SocketType.Stream, ProtocolType.Tcp);
await targetSocket.ConnectAsync(endpoint);
var responseFeature = context.Features.Get<IHttpResponseFeature>();
if (responseFeature != null)
{
responseFeature.ReasonPhrase = "Connection Established";
}
context.Response.StatusCode = StatusCodes.Status200OK;
context.Features.Get<IHttpResponseFeature>().ReasonPhrase = "Connection Established";
await context.Response.CompleteAsync();
var transport = context.Features.Get<IConnectionTransportFeature>()?.Transport;
@ -144,7 +148,7 @@ namespace FastGithub.HttpServer
/// <param name="host"></param>
/// <returns></returns>
private async Task<EndPoint> GetTargetEndPointAsync(HostString host)
{
{
var targetHost = host.Host;
var targetPort = host.Port ?? HTTPS_PORT;

View File

@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31507.150
# Visual Studio Version 17
VisualStudioVersion = 17.0.31808.319
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FastGithub", "FastGithub\FastGithub.csproj", "{C1099390-6103-4917-A740-A3002B542FE0}"
EndProject