Skip to content

Commit 25d5688

Browse files
authored
Remove connection adapters and move things to middleware (#11412)
* Remove connection adapters and move things to middleware - Remove connection adapters from the public API surface (pubternal) and replace the existing adapters with connection middleware. - Updated the tests
1 parent c5d62b4 commit 25d5688

37 files changed

+341
-863
lines changed

src/Servers/Kestrel/Core/ref/Microsoft.AspNetCore.Server.Kestrel.Core.netcoreapp3.0.cs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ public partial class ListenOptions : Microsoft.AspNetCore.Connections.IConnectio
143143
{
144144
internal ListenOptions() { }
145145
public System.IServiceProvider ApplicationServices { get { throw null; } }
146-
public System.Collections.Generic.List<Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal.IConnectionAdapter> ConnectionAdapters { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
147146
public ulong FileHandle { get { throw null; } }
148147
public System.Net.IPEndPoint IPEndPoint { get { throw null; } }
149148
public Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerOptions KestrelServerOptions { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
@@ -160,24 +159,6 @@ public MinDataRate(double bytesPerSecond, System.TimeSpan gracePeriod) { }
160159
public System.TimeSpan GracePeriod { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
161160
}
162161
}
163-
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal
164-
{
165-
public partial class ConnectionAdapterContext
166-
{
167-
internal ConnectionAdapterContext() { }
168-
public System.IO.Stream ConnectionStream { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
169-
public Microsoft.AspNetCore.Http.Features.IFeatureCollection Features { get { throw null; } }
170-
}
171-
public partial interface IAdaptedConnection : System.IDisposable
172-
{
173-
System.IO.Stream ConnectionStream { get; }
174-
}
175-
public partial interface IConnectionAdapter
176-
{
177-
bool IsHttps { get; }
178-
System.Threading.Tasks.Task<Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal.IAdaptedConnection> OnConnectionAsync(Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal.ConnectionAdapterContext context);
179-
}
180-
}
181162
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Features
182163
{
183164
public partial interface IConnectionTimeoutFeature

src/Servers/Kestrel/Core/src/Adapter/Internal/AdaptedPipeline.cs

Lines changed: 0 additions & 173 deletions
This file was deleted.

src/Servers/Kestrel/Core/src/Adapter/Internal/ConnectionAdapterContext.cs

Lines changed: 0 additions & 26 deletions
This file was deleted.

src/Servers/Kestrel/Core/src/Adapter/Internal/IAdaptedConnection.cs

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/Servers/Kestrel/Core/src/Adapter/Internal/IConnectionAdapter.cs

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/Servers/Kestrel/Core/src/Adapter/Internal/LoggingConnectionAdapter.cs

Lines changed: 0 additions & 47 deletions
This file was deleted.

src/Servers/Kestrel/Core/src/HttpsConnectionAdapterOptions.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

44
using System;
5-
using System.IO.Pipelines;
65
using System.Net.Security;
76
using System.Security.Authentication;
87
using System.Security.Cryptography.X509Certificates;
@@ -97,11 +96,5 @@ public TimeSpan HandshakeTimeout
9796
_handshakeTimeout = value != Timeout.InfiniteTimeSpan ? value : TimeSpan.MaxValue;
9897
}
9998
}
100-
101-
internal PipeScheduler Scheduler { get; set; } = PipeScheduler.ThreadPool;
102-
103-
internal long? MaxInputBufferSize { get; set; }
104-
105-
internal long? MaxOutputBufferSize { get; set; }
10699
}
107100
}

src/Servers/Kestrel/Core/src/Internal/AddressBinder.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,7 @@ public async Task BindAsync(AddressBindContext context)
171171
var httpsDefault = ParseAddress(Constants.DefaultServerHttpsAddress, out https);
172172
context.ServerOptions.ApplyEndpointDefaults(httpsDefault);
173173

174-
if (httpsDefault.ConnectionAdapters.Any(f => f.IsHttps)
175-
|| httpsDefault.TryUseHttps())
174+
if (httpsDefault.IsTls || httpsDefault.TryUseHttps())
176175
{
177176
await httpsDefault.BindAsync(context).ConfigureAwait(false);
178177
context.Logger.LogDebug(CoreStrings.BindingToDefaultAddresses,
@@ -255,7 +254,7 @@ public virtual async Task BindAsync(AddressBindContext context)
255254
var options = ParseAddress(address, out var https);
256255
context.ServerOptions.ApplyEndpointDefaults(options);
257256

258-
if (https && !options.ConnectionAdapters.Any(f => f.IsHttps))
257+
if (https && !options.IsTls)
259258
{
260259
options.UseHttps();
261260
}

src/Servers/Kestrel/Core/src/Internal/ConnectionDispatcher.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ internal async Task Execute(KestrelConnection connection)
8686
}
8787
catch (Exception ex)
8888
{
89-
Log.LogCritical(0, ex, $"{nameof(ConnectionDispatcher)}.{nameof(Execute)}() {connectionContext.ConnectionId}");
89+
Log.LogError(0, ex, "Unhandled exception while processing {ConnectionId}.", connectionContext.ConnectionId);
9090
}
9191
}
9292
}

0 commit comments

Comments
 (0)