Skip to content

Merging internal commits for release/7.0 #49925

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
8ab1b38
Merge in 'release/7.0' changes
dotnet-bot Jul 5, 2023
aeaac1f
[internal/release/7.0] Update dependencies from dnceng/internal/dotne…
dotnet-bot Jul 6, 2023
c942d14
[internal/release/7.0] Update dependencies from dnceng/internal/dotne…
dotnet-bot Jul 6, 2023
fcd30cf
Merge in 'release/7.0' changes
dotnet-bot Jul 6, 2023
6031483
Merged PR 31899: Avoid Redis pattern matching
BrennanConroy Jul 6, 2023
f6a45b9
Merge in 'release/7.0' changes
dotnet-bot Jul 7, 2023
cb6d26d
[internal/release/7.0] Update dependencies from dnceng/internal/dotne…
dotnet-bot Jul 10, 2023
6a3e58e
Merge in 'release/7.0' changes
dotnet-bot Jul 11, 2023
e0b9342
[internal/release/7.0] Update dependencies from dnceng/internal/dotne…
dotnet-bot Jul 12, 2023
9de1c06
Merged PR 32557: [internal/release/7.0] Merge from public
mmitche Jul 12, 2023
cfac574
[internal/release/7.0] Update dependencies from dnceng/internal/dotne…
dotnet-bot Jul 12, 2023
2b9d3cf
[internal/release/7.0] Update dependencies from dnceng/internal/dotne…
dotnet-bot Jul 13, 2023
02e9634
Merged PR 32585: [internal/release/7.0] Merge from public
vseanreesermsft Jul 13, 2023
1b6ac8f
Update dependencies from https://dev.azure.com/dnceng/internal/_git/d…
dotnet-bot Jul 14, 2023
5b4c366
Merged PR 32595: [internal/release/7.0] Update dependencies from dnce…
dotnet-bot Jul 14, 2023
5a4c82e
Merged PR 32090: [7.0] Forcibly close socket on abort
amcasey Jul 15, 2023
2ae5cc0
Merge commit '5a4c82ec57fadddef9ce841d608de5c7c8c74446' into internal…
vseanreesermsft Aug 8, 2023
09c4b50
Update baseline, SDK
wtgodbe Aug 8, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions NuGet.config
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
<clear />
<!--Begin: Package sources managed by Dependency Flow automation. Do not edit the sources below.-->
<!-- Begin: Package sources from dotnet-efcore -->
<add key="darc-int-dotnet-efcore-8907538" value="https://pkgs.dev.azure.com/dnceng/internal/_packaging/darc-int-dotnet-efcore-8907538f/nuget/v3/index.json" />
<!-- End: Package sources from dotnet-efcore -->
<!-- Begin: Package sources from dotnet-runtime -->
<add key="darc-int-dotnet-runtime-a6dbb80" value="https://pkgs.dev.azure.com/dnceng/internal/_packaging/darc-int-dotnet-runtime-a6dbb800/nuget/v3/index.json" />
<!-- End: Package sources from dotnet-runtime -->
<!--End: Package sources managed by Dependency Flow automation. Do not edit the sources above.-->
<add key="dotnet-eng" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" />
Expand All @@ -24,8 +26,10 @@
<clear />
<!--Begin: Package sources managed by Dependency Flow automation. Do not edit the sources below.-->
<!-- Begin: Package sources from dotnet-efcore -->
<add key="darc-int-dotnet-efcore-8907538" value="true" />
<!-- End: Package sources from dotnet-efcore -->
<!-- Begin: Package sources from dotnet-runtime -->
<add key="darc-int-dotnet-runtime-a6dbb80" value="true" />
<!-- End: Package sources from dotnet-runtime -->
<!--End: Package sources managed by Dependency Flow automation. Do not edit the sources above.-->
</disabledPackageSources>
Expand Down
420 changes: 210 additions & 210 deletions eng/Baseline.Designer.props

Large diffs are not rendered by default.

208 changes: 104 additions & 104 deletions eng/Baseline.xml

Large diffs are not rendered by default.

62 changes: 31 additions & 31 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,37 +9,37 @@
-->
<Dependencies>
<ProductDependencies>
<Dependency Name="dotnet-ef" Version="7.0.9">
<Dependency Name="dotnet-ef" Version="7.0.10">
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-efcore</Uri>
<Sha>e00be013488a9a56a0e29230be0fe10026dbb209</Sha>
<Sha>8907538f3d4da2fffdb0516f05542802585757e6</Sha>
</Dependency>
<Dependency Name="Microsoft.EntityFrameworkCore.InMemory" Version="7.0.9">
<Dependency Name="Microsoft.EntityFrameworkCore.InMemory" Version="7.0.10">
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-efcore</Uri>
<Sha>e00be013488a9a56a0e29230be0fe10026dbb209</Sha>
<Sha>8907538f3d4da2fffdb0516f05542802585757e6</Sha>
</Dependency>
<Dependency Name="Microsoft.EntityFrameworkCore.Relational" Version="7.0.9">
<Dependency Name="Microsoft.EntityFrameworkCore.Relational" Version="7.0.10">
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-efcore</Uri>
<Sha>e00be013488a9a56a0e29230be0fe10026dbb209</Sha>
<Sha>8907538f3d4da2fffdb0516f05542802585757e6</Sha>
</Dependency>
<Dependency Name="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.9">
<Dependency Name="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.10">
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-efcore</Uri>
<Sha>e00be013488a9a56a0e29230be0fe10026dbb209</Sha>
<Sha>8907538f3d4da2fffdb0516f05542802585757e6</Sha>
</Dependency>
<Dependency Name="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.9">
<Dependency Name="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.10">
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-efcore</Uri>
<Sha>e00be013488a9a56a0e29230be0fe10026dbb209</Sha>
<Sha>8907538f3d4da2fffdb0516f05542802585757e6</Sha>
</Dependency>
<Dependency Name="Microsoft.EntityFrameworkCore.Tools" Version="7.0.9">
<Dependency Name="Microsoft.EntityFrameworkCore.Tools" Version="7.0.10">
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-efcore</Uri>
<Sha>e00be013488a9a56a0e29230be0fe10026dbb209</Sha>
<Sha>8907538f3d4da2fffdb0516f05542802585757e6</Sha>
</Dependency>
<Dependency Name="Microsoft.EntityFrameworkCore" Version="7.0.9">
<Dependency Name="Microsoft.EntityFrameworkCore" Version="7.0.10">
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-efcore</Uri>
<Sha>e00be013488a9a56a0e29230be0fe10026dbb209</Sha>
<Sha>8907538f3d4da2fffdb0516f05542802585757e6</Sha>
</Dependency>
<Dependency Name="Microsoft.EntityFrameworkCore.Design" Version="7.0.9">
<Dependency Name="Microsoft.EntityFrameworkCore.Design" Version="7.0.10">
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-efcore</Uri>
<Sha>e00be013488a9a56a0e29230be0fe10026dbb209</Sha>
<Sha>8907538f3d4da2fffdb0516f05542802585757e6</Sha>
</Dependency>
<Dependency Name="Microsoft.Extensions.Caching.Abstractions" Version="7.0.0">
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-runtime</Uri>
Expand Down Expand Up @@ -177,9 +177,9 @@
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-runtime</Uri>
<Sha>d099f075e45d2aa6007a22b71b45a08758559f80</Sha>
</Dependency>
<Dependency Name="Microsoft.Internal.Runtime.AspNetCore.Transport" Version="7.0.9-servicing.23320.18">
<Dependency Name="Microsoft.Internal.Runtime.AspNetCore.Transport" Version="7.0.10-servicing.23363.12">
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-runtime</Uri>
<Sha>8e9a17b2216f51a5788f8b1c467a4cf3b769e7d7</Sha>
<Sha>a6dbb800a47735bde43187350fd3aff4071c7f9c</Sha>
</Dependency>
<Dependency Name="Microsoft.SourceBuild.Intermediate.source-build-externals" Version="7.0.0-alpha.1.22505.1">
<Uri>https://github.com/dotnet/source-build-externals</Uri>
Expand Down Expand Up @@ -262,33 +262,33 @@
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-runtime</Uri>
<Sha>d099f075e45d2aa6007a22b71b45a08758559f80</Sha>
</Dependency>
<Dependency Name="Microsoft.NETCore.App.Ref" Version="7.0.9">
<Dependency Name="Microsoft.NETCore.App.Ref" Version="7.0.10">
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-runtime</Uri>
<Sha>8e9a17b2216f51a5788f8b1c467a4cf3b769e7d7</Sha>
<Sha>a6dbb800a47735bde43187350fd3aff4071c7f9c</Sha>
</Dependency>
<Dependency Name="Microsoft.NET.Runtime.MonoAOTCompiler.Task" Version="7.0.9">
<Dependency Name="Microsoft.NET.Runtime.MonoAOTCompiler.Task" Version="7.0.10">
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-runtime</Uri>
<Sha>8e9a17b2216f51a5788f8b1c467a4cf3b769e7d7</Sha>
<Sha>a6dbb800a47735bde43187350fd3aff4071c7f9c</Sha>
</Dependency>
<Dependency Name="Microsoft.NET.Runtime.WebAssembly.Sdk" Version="7.0.9">
<Dependency Name="Microsoft.NET.Runtime.WebAssembly.Sdk" Version="7.0.10">
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-runtime</Uri>
<Sha>8e9a17b2216f51a5788f8b1c467a4cf3b769e7d7</Sha>
<Sha>a6dbb800a47735bde43187350fd3aff4071c7f9c</Sha>
</Dependency>
<!--
Win-x64 is used here because we have picked an arbitrary runtime identifier to flow the version of the latest NETCore.App runtime.
All Runtime.$rid packages should have the same version.
-->
<Dependency Name="Microsoft.NETCore.App.Runtime.win-x64" Version="7.0.9">
<Dependency Name="Microsoft.NETCore.App.Runtime.win-x64" Version="7.0.10">
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-runtime</Uri>
<Sha>8e9a17b2216f51a5788f8b1c467a4cf3b769e7d7</Sha>
<Sha>a6dbb800a47735bde43187350fd3aff4071c7f9c</Sha>
</Dependency>
<Dependency Name="Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.browser-wasm" Version="7.0.9">
<Dependency Name="Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.browser-wasm" Version="7.0.10">
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-runtime</Uri>
<Sha>8e9a17b2216f51a5788f8b1c467a4cf3b769e7d7</Sha>
<Sha>a6dbb800a47735bde43187350fd3aff4071c7f9c</Sha>
</Dependency>
<Dependency Name="Microsoft.NETCore.BrowserDebugHost.Transport" Version="7.0.9-servicing.23320.18">
<Dependency Name="Microsoft.NETCore.BrowserDebugHost.Transport" Version="7.0.10-servicing.23363.12">
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-runtime</Uri>
<Sha>8e9a17b2216f51a5788f8b1c467a4cf3b769e7d7</Sha>
<Sha>a6dbb800a47735bde43187350fd3aff4071c7f9c</Sha>
</Dependency>
<Dependency Name="Microsoft.Web.Xdt" Version="7.0.0-preview.22423.2">
<Uri>https://github.com/dotnet/xdt</Uri>
Expand All @@ -300,7 +300,7 @@
<!-- Listed explicitly to workaround https://github.com/dotnet/cli/issues/10528 -->
<Dependency Name="Microsoft.NETCore.Platforms" Version="7.0.4">
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-runtime</Uri>
<Sha>8e9a17b2216f51a5788f8b1c467a4cf3b769e7d7</Sha>
<Sha>8587d13a2764c025277d628471984bae8e16427c</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="7.0.0-beta.23361.2">
<Uri>https://github.com/dotnet/arcade</Uri>
Expand Down
32 changes: 16 additions & 16 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<AspNetCoreMajorVersion>7</AspNetCoreMajorVersion>
<AspNetCoreMinorVersion>0</AspNetCoreMinorVersion>
<AspNetCorePatchVersion>11</AspNetCorePatchVersion>
<ValidateBaseline>false</ValidateBaseline>
<ValidateBaseline>true</ValidateBaseline>
<!--
When StabilizePackageVersion is set to 'true', this branch will produce stable outputs for 'Shipping' packages
-->
Expand Down Expand Up @@ -63,12 +63,12 @@
<PropertyGroup Label="Automated">
<!-- Packages from dotnet/runtime -->
<MicrosoftExtensionsDependencyModelVersion>7.0.0</MicrosoftExtensionsDependencyModelVersion>
<MicrosoftNETCoreAppRefVersion>7.0.9</MicrosoftNETCoreAppRefVersion>
<MicrosoftNETCoreAppRuntimewinx64Version>7.0.9</MicrosoftNETCoreAppRuntimewinx64Version>
<MicrosoftNETRuntimeMonoAOTCompilerTaskVersion>7.0.9</MicrosoftNETRuntimeMonoAOTCompilerTaskVersion>
<MicrosoftNETRuntimeWebAssemblySdkVersion>7.0.9</MicrosoftNETRuntimeWebAssemblySdkVersion>
<MicrosoftNETCoreAppRuntimeAOTwinx64CrossbrowserwasmVersion>7.0.9</MicrosoftNETCoreAppRuntimeAOTwinx64CrossbrowserwasmVersion>
<MicrosoftNETCoreBrowserDebugHostTransportVersion>7.0.9-servicing.23320.18</MicrosoftNETCoreBrowserDebugHostTransportVersion>
<MicrosoftNETCoreAppRefVersion>7.0.10</MicrosoftNETCoreAppRefVersion>
<MicrosoftNETCoreAppRuntimewinx64Version>7.0.10</MicrosoftNETCoreAppRuntimewinx64Version>
<MicrosoftNETRuntimeMonoAOTCompilerTaskVersion>7.0.10</MicrosoftNETRuntimeMonoAOTCompilerTaskVersion>
<MicrosoftNETRuntimeWebAssemblySdkVersion>7.0.10</MicrosoftNETRuntimeWebAssemblySdkVersion>
<MicrosoftNETCoreAppRuntimeAOTwinx64CrossbrowserwasmVersion>7.0.10</MicrosoftNETCoreAppRuntimeAOTwinx64CrossbrowserwasmVersion>
<MicrosoftNETCoreBrowserDebugHostTransportVersion>7.0.10-servicing.23363.12</MicrosoftNETCoreBrowserDebugHostTransportVersion>
<MicrosoftExtensionsCachingAbstractionsVersion>7.0.0</MicrosoftExtensionsCachingAbstractionsVersion>
<MicrosoftExtensionsCachingMemoryVersion>7.0.0</MicrosoftExtensionsCachingMemoryVersion>
<MicrosoftExtensionsConfigurationAbstractionsVersion>7.0.0</MicrosoftExtensionsConfigurationAbstractionsVersion>
Expand Down Expand Up @@ -103,7 +103,7 @@
<MicrosoftExtensionsOptionsDataAnnotationsVersion>7.0.0</MicrosoftExtensionsOptionsDataAnnotationsVersion>
<MicrosoftExtensionsOptionsVersion>7.0.1</MicrosoftExtensionsOptionsVersion>
<MicrosoftExtensionsPrimitivesVersion>7.0.0</MicrosoftExtensionsPrimitivesVersion>
<MicrosoftInternalRuntimeAspNetCoreTransportVersion>7.0.9-servicing.23320.18</MicrosoftInternalRuntimeAspNetCoreTransportVersion>
<MicrosoftInternalRuntimeAspNetCoreTransportVersion>7.0.10-servicing.23363.12</MicrosoftInternalRuntimeAspNetCoreTransportVersion>
<SystemConfigurationConfigurationManagerVersion>7.0.0</SystemConfigurationConfigurationManagerVersion>
<SystemDiagnosticsDiagnosticSourceVersion>7.0.2</SystemDiagnosticsDiagnosticSourceVersion>
<SystemDiagnosticsEventLogVersion>7.0.0</SystemDiagnosticsEventLogVersion>
Expand All @@ -125,14 +125,14 @@
<!-- Only listed explicitly to workaround https://github.com/dotnet/cli/issues/10528 -->
<MicrosoftNETCorePlatformsVersion>7.0.4</MicrosoftNETCorePlatformsVersion>
<!-- Packages from dotnet/efcore -->
<dotnetefVersion>7.0.9</dotnetefVersion>
<MicrosoftEntityFrameworkCoreInMemoryVersion>7.0.9</MicrosoftEntityFrameworkCoreInMemoryVersion>
<MicrosoftEntityFrameworkCoreRelationalVersion>7.0.9</MicrosoftEntityFrameworkCoreRelationalVersion>
<MicrosoftEntityFrameworkCoreSqliteVersion>7.0.9</MicrosoftEntityFrameworkCoreSqliteVersion>
<MicrosoftEntityFrameworkCoreSqlServerVersion>7.0.9</MicrosoftEntityFrameworkCoreSqlServerVersion>
<MicrosoftEntityFrameworkCoreToolsVersion>7.0.9</MicrosoftEntityFrameworkCoreToolsVersion>
<MicrosoftEntityFrameworkCoreVersion>7.0.9</MicrosoftEntityFrameworkCoreVersion>
<MicrosoftEntityFrameworkCoreDesignVersion>7.0.9</MicrosoftEntityFrameworkCoreDesignVersion>
<dotnetefVersion>7.0.10</dotnetefVersion>
<MicrosoftEntityFrameworkCoreInMemoryVersion>7.0.10</MicrosoftEntityFrameworkCoreInMemoryVersion>
<MicrosoftEntityFrameworkCoreRelationalVersion>7.0.10</MicrosoftEntityFrameworkCoreRelationalVersion>
<MicrosoftEntityFrameworkCoreSqliteVersion>7.0.10</MicrosoftEntityFrameworkCoreSqliteVersion>
<MicrosoftEntityFrameworkCoreSqlServerVersion>7.0.10</MicrosoftEntityFrameworkCoreSqlServerVersion>
<MicrosoftEntityFrameworkCoreToolsVersion>7.0.10</MicrosoftEntityFrameworkCoreToolsVersion>
<MicrosoftEntityFrameworkCoreVersion>7.0.10</MicrosoftEntityFrameworkCoreVersion>
<MicrosoftEntityFrameworkCoreDesignVersion>7.0.10</MicrosoftEntityFrameworkCoreDesignVersion>
<!-- Packages from dotnet/arcade -->
<MicrosoftDotNetBuildTasksInstallersVersion>7.0.0-beta.23361.2</MicrosoftDotNetBuildTasksInstallersVersion>
<MicrosoftDotNetBuildTasksTemplatingVersion>7.0.0-beta.23361.2</MicrosoftDotNetBuildTasksTemplatingVersion>
Expand Down
4 changes: 2 additions & 2 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"sdk": {
"version": "7.0.109"
"version": "7.0.110"
},
"tools": {
"dotnet": "7.0.109",
"dotnet": "7.0.110",
"runtimes": {
"dotnet/x86": [
"$(MicrosoftNETCoreBrowserDebugHostTransportVersion)"
Expand Down
7 changes: 7 additions & 0 deletions src/Servers/IIS/IIS/test/Common.LongTests/ShutdownTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -535,8 +535,15 @@ public async Task ClosesConnectionOnServerAbortOutOfProcess()
var response = await deploymentResult.HttpClient.GetAsync("/Abort").TimeoutAfter(TimeoutExtensions.DefaultTimeoutValue);

Assert.Equal(HttpStatusCode.BadGateway, response.StatusCode);

#if NEWSHIM_FUNCTIONALS
// In-proc SocketConnection isn't used and there's no abort
// 0x80072f78 ERROR_HTTP_INVALID_SERVER_RESPONSE The server returned an invalid or unrecognized response
Assert.Contains("0x80072f78", await response.Content.ReadAsStringAsync());
#else
// 0x80072efe ERROR_INTERNET_CONNECTION_ABORTED The connection with the server was terminated abnormally
Assert.Contains("0x80072efe", await response.Content.ReadAsStringAsync());
#endif
}
catch (HttpRequestException)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,14 @@ protected override void OnRequestProcessingEnded()
_http1Output.Dispose();
}

public void OnInputOrOutputCompleted()
void IRequestProcessor.OnInputOrOutputCompleted()
{
// Closed gracefully.
_http1Output.Abort(ServerOptions.FinOnError ? new ConnectionAbortedException(CoreStrings.ConnectionAbortedByClient) : null!);
CancelRequestAbortedToken();
}

void IHttpOutputAborter.OnInputOrOutputCompleted()
{
_http1Output.Abort(new ConnectionAbortedException(CoreStrings.ConnectionAbortedByClient));
CancelRequestAbortedToken();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ protected void ThrowUnexpectedEndOfRequestContent()
// so we call OnInputOrOutputCompleted() now to prevent a race in our tests where a 400
// response is written after observing the unexpected end of request content instead of just
// closing the connection without a response as expected.
_context.OnInputOrOutputCompleted();
((IHttpOutputAborter)_context).OnInputOrOutputCompleted();

KestrelBadHttpRequestException.Throw(RequestRejectionReason.UnexpectedEndOfRequestContent);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@ public Http2Connection(HttpConnectionContext context)
public void OnInputOrOutputCompleted()
{
TryClose();
_frameWriter.Abort(new ConnectionAbortedException(CoreStrings.ConnectionAbortedByClient));
var useException = _context.ServiceContext.ServerOptions.FinOnError || _clientActiveStreamCount != 0;
_frameWriter.Abort(useException ? new ConnectionAbortedException(CoreStrings.ConnectionAbortedByClient) : null!);
}

public void Abort(ConnectionAbortedException ex)
Expand Down
10 changes: 10 additions & 0 deletions src/Servers/Kestrel/Core/src/KestrelServerOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,20 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core;
public class KestrelServerOptions
{
internal const string DisableHttp1LineFeedTerminatorsSwitchKey = "Microsoft.AspNetCore.Server.Kestrel.DisableHttp1LineFeedTerminators";
private const string FinOnErrorSwitch = "Microsoft.AspNetCore.Server.Kestrel.FinOnError";
private static readonly bool _finOnError;

static KestrelServerOptions()
{
AppContext.TryGetSwitch(FinOnErrorSwitch, out _finOnError);
}

// internal to fast-path header decoding when RequestHeaderEncodingSelector is unchanged.
internal static readonly Func<string, Encoding?> DefaultHeaderEncodingSelector = _ => null;

// Opt-out flag for back compat. Remove in 9.0 (or make public).
internal bool FinOnError { get; set; } = _finOnError;

private Func<string, Encoding?> _requestHeaderEncodingSelector = DefaultHeaderEncodingSelector;

private Func<string, Encoding?> _responseHeaderEncodingSelector = DefaultHeaderEncodingSelector;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ internal sealed partial class SocketConnection : TransportConnection
private readonly TaskCompletionSource _waitForConnectionClosedTcs = new TaskCompletionSource();
private bool _connectionClosed;
private readonly bool _waitForData;
private readonly bool _finOnError;

internal SocketConnection(Socket socket,
MemoryPool<byte> memoryPool,
Expand All @@ -38,7 +39,8 @@ internal SocketConnection(Socket socket,
SocketSenderPool socketSenderPool,
PipeOptions inputOptions,
PipeOptions outputOptions,
bool waitForData = true)
bool waitForData = true,
bool finOnError = false)
{
Debug.Assert(socket != null);
Debug.Assert(memoryPool != null);
Expand All @@ -49,6 +51,7 @@ internal SocketConnection(Socket socket,
_logger = logger;
_waitForData = waitForData;
_socketSenderPool = socketSenderPool;
_finOnError = finOnError;

LocalEndPoint = _socket.LocalEndPoint;
RemoteEndPoint = _socket.RemoteEndPoint;
Expand Down Expand Up @@ -380,11 +383,21 @@ private void Shutdown(Exception? shutdownReason)
// ever observe the nondescript ConnectionAbortedException except for connection middleware attempting
// to half close the connection which is currently unsupported.
_shutdownReason = shutdownReason ?? new ConnectionAbortedException("The Socket transport's send loop completed gracefully.");

// NB: not _shutdownReason since we don't want to do this on graceful completion
if (!_finOnError && shutdownReason is not null)
{
SocketsLog.ConnectionWriteRst(_logger, this, shutdownReason.Message);

// This forces an abortive close with linger time 0 (and implies Dispose)
_socket.Close(timeout: 0);
return;
}

SocketsLog.ConnectionWriteFin(_logger, this, _shutdownReason.Message);

try
{
// Try to gracefully close the socket even for aborts to match libuv behavior.
_socket.Shutdown(SocketShutdown.Both);
}
catch
Expand Down
Loading