Skip to content
This repository was archived by the owner on Dec 18, 2018. It is now read-only.

Commit bd48264

Browse files
committed
Merge Kestrel.Https into Kestrel.Core. Fix sample.
1 parent 2b54b2f commit bd48264

17 files changed

+103
-254
lines changed

samples/SampleApp/SampleApp.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks>
4+
<TargetFrameworks>netcoreapp2.1;netcoreapp2.0;net461</TargetFrameworks>
55
<IsPackable>false</IsPackable>
66
<NoDefaultLaunchSettingsFile>true</NoDefaultLaunchSettingsFile>
77
</PropertyGroup>

samples/SampleApp/testCert.pfx

2.42 KB
Binary file not shown.

src/Kestrel.Core/CoreStrings.resx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,4 +465,19 @@
465465
<data name="UnableToConfigureHttpsBindings" xml:space="preserve">
466466
<value>Unable to configure default https bindings because no IDefaultHttpsProvider service was provided.</value>
467467
</data>
468+
<data name="AuthenticationFailed" xml:space="preserve">
469+
<value>Failed to authenticate HTTPS connection.</value>
470+
</data>
471+
<data name="AuthenticationTimedOut" xml:space="preserve">
472+
<value>Authentication of the HTTPS connection timed out.</value>
473+
</data>
474+
<data name="InvalidServerCertificateEku" xml:space="preserve">
475+
<value>Certificate {thumbprint} cannot be used as an SSL server certificate. It has an Extended Key Usage extension but the usages do not include Server Authentication (OID 1.3.6.1.5.5.7.3.1).</value>
476+
</data>
477+
<data name="PositiveTimeSpanRequired1" xml:space="preserve">
478+
<value>Value must be a positive TimeSpan.</value>
479+
</data>
480+
<data name="ServiceCertificateRequired" xml:space="preserve">
481+
<value>The server certificate parameter is required.</value>
482+
</data>
468483
</root>

src/Kestrel.Https/HttpsConnectionAdapterOptions.cs renamed to src/Kestrel.Core/HttpsConnectionAdapterOptions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public TimeSpan HandshakeTimeout
7373
{
7474
if (value <= TimeSpan.Zero && value != Timeout.InfiniteTimeSpan)
7575
{
76-
throw new ArgumentOutOfRangeException(nameof(value), HttpsStrings.PositiveTimeSpanRequired);
76+
throw new ArgumentOutOfRangeException(nameof(value), CoreStrings.PositiveTimeSpanRequired);
7777
}
7878
_handshakeTimeout = value != Timeout.InfiniteTimeSpan ? value : TimeSpan.MaxValue;
7979
}

src/Kestrel.Https/Internal/HttpsConnectionAdapter.cs renamed to src/Kestrel.Core/Internal/HttpsConnectionAdapter.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public HttpsConnectionAdapter(HttpsConnectionAdapterOptions options, ILoggerFact
4343

4444
if (options.ServerCertificate == null)
4545
{
46-
throw new ArgumentException(HttpsStrings.ServiceCertificateRequired, nameof(options));
46+
throw new ArgumentException(CoreStrings.ServiceCertificateRequired, nameof(options));
4747
}
4848

4949
// capture the certificate now so it can be switched after validation
@@ -148,13 +148,13 @@ await sslStream.AuthenticateAsServerAsync(_serverCertificate, certificateRequire
148148
}
149149
catch (OperationCanceledException)
150150
{
151-
_logger?.LogInformation(2, HttpsStrings.AuthenticationTimedOut);
151+
_logger?.LogInformation(2, CoreStrings.AuthenticationTimedOut);
152152
sslStream.Dispose();
153153
return _closedAdaptedConnection;
154154
}
155155
catch (IOException ex)
156156
{
157-
_logger?.LogInformation(1, ex, HttpsStrings.AuthenticationFailed);
157+
_logger?.LogInformation(1, ex, CoreStrings.AuthenticationFailed);
158158
sslStream.Dispose();
159159
return _closedAdaptedConnection;
160160
}
@@ -218,7 +218,7 @@ private static void EnsureCertificateIsAllowedForServerAuth(X509Certificate2 cer
218218

219219
if (hasEkuExtension)
220220
{
221-
throw new InvalidOperationException(HttpsStrings.FormatInvalidServerCertificateEku(certificate.Thumbprint));
221+
throw new InvalidOperationException(CoreStrings.FormatInvalidServerCertificateEku(certificate.Thumbprint));
222222
}
223223
}
224224

src/Kestrel.Core/Properties/CoreStrings.Designer.cs

Lines changed: 70 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Kestrel.Https/HttpsStrings.resx

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

src/Kestrel.Https/Kestrel.Https.csproj

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,4 @@
1818
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="$(MicrosoftAspNetCoreHttpAbstractionsPackageVersion)" />
1919
</ItemGroup>
2020

21-
<ItemGroup>
22-
<EmbeddedResource Update="HttpsStrings.resx">
23-
<Generator></Generator>
24-
</EmbeddedResource>
25-
</ItemGroup>
26-
2721
</Project>

src/Kestrel.Https/Properties/AssemblyInfo.cs

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

44
using System.Runtime.CompilerServices;
5+
using Microsoft.AspNetCore.Hosting;
6+
using Microsoft.AspNetCore.Server.Kestrel.Https;
7+
using Microsoft.AspNetCore.Server.Kestrel.Https.Internal;
58

6-
[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.FunctionalTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
7-
[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.FunctionalTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
8-
9+
[assembly: TypeForwardedTo(typeof(ClientCertificateMode))]
10+
[assembly: TypeForwardedTo(typeof(HttpsConnectionAdapter))]
11+
[assembly: TypeForwardedTo(typeof(HttpsConnectionAdapterOptions))]
12+
[assembly: TypeForwardedTo(typeof(ListenOptionsHttpsExtensions))]

0 commit comments

Comments
 (0)