|
|
@@ -40,8 +40,8 @@ public class KestrelConfigurationLoaderTests
|
|
|
var serverOptions = CreateServerOptions();
|
|
|
var config = new ConfigurationBuilder().AddInMemoryCollection(new[]
|
|
|
{
|
|
|
- new KeyValuePair<string, string>("Endpoints:Found:Url", "http://*:5001"),
|
|
|
- }).Build();
|
|
|
+ new KeyValuePair<string, string>("Endpoints:Found:Url", "http://*:5001"),
|
|
|
+ }).Build();
|
|
|
serverOptions.Configure(config)
|
|
|
.Endpoint("Found", endpointOptions => found = true)
|
|
|
.Endpoint("NotFound", endpointOptions => throw new NotImplementedException())
|
|
|
@@ -101,8 +101,8 @@ public class KestrelConfigurationLoaderTests
|
|
|
var serverOptions = CreateServerOptions();
|
|
|
var config1 = new ConfigurationBuilder().AddInMemoryCollection(new[]
|
|
|
{
|
|
|
- new KeyValuePair<string, string>("Endpoints:End1:Url", "http://*:5001"),
|
|
|
- }).Build();
|
|
|
+ new KeyValuePair<string, string>("Endpoints:End1:Url", "http://*:5001"),
|
|
|
+ }).Build();
|
|
|
serverOptions.Configure(config1)
|
|
|
.LocalhostEndpoint(5001, endpointOptions => run1 = true);
|
|
|
|
|
|
@@ -112,8 +112,8 @@ public class KestrelConfigurationLoaderTests
|
|
|
var run2 = false;
|
|
|
var config2 = new ConfigurationBuilder().AddInMemoryCollection(new[]
|
|
|
{
|
|
|
- new KeyValuePair<string, string>("Endpoints:End2:Url", "http://*:5002"),
|
|
|
- }).Build();
|
|
|
+ new KeyValuePair<string, string>("Endpoints:End2:Url", "http://*:5002"),
|
|
|
+ }).Build();
|
|
|
serverOptions.Configure(config2)
|
|
|
.LocalhostEndpoint(5003, endpointOptions => run2 = true);
|
|
|
|
|
|
@@ -147,8 +147,8 @@ public class KestrelConfigurationLoaderTests
|
|
|
var ran2 = false;
|
|
|
var config = new ConfigurationBuilder().AddInMemoryCollection(new[]
|
|
|
{
|
|
|
- new KeyValuePair<string, string>("Endpoints:End1:Url", "https://*:5001"),
|
|
|
- }).Build();
|
|
|
+ new KeyValuePair<string, string>("Endpoints:End1:Url", "https://*:5001"),
|
|
|
+ }).Build();
|
|
|
serverOptions.Configure(config)
|
|
|
.Endpoint("End1", opt =>
|
|
|
{
|
|
|
@@ -191,8 +191,8 @@ public class KestrelConfigurationLoaderTests
|
|
|
var ran2 = false;
|
|
|
var config = new ConfigurationBuilder().AddInMemoryCollection(new[]
|
|
|
{
|
|
|
- new KeyValuePair<string, string>("Endpoints:End1:Url", "https://*:5001"),
|
|
|
- }).Build();
|
|
|
+ new KeyValuePair<string, string>("Endpoints:End1:Url", "https://*:5001"),
|
|
|
+ }).Build();
|
|
|
serverOptions.Configure(config)
|
|
|
.Endpoint("End1", opt =>
|
|
|
{
|
|
|
@@ -262,10 +262,10 @@ public class KestrelConfigurationLoaderTests
|
|
|
|
|
|
var config = new ConfigurationBuilder().AddInMemoryCollection(new[]
|
|
|
{
|
|
|
- new KeyValuePair<string, string>("Endpoints:End1:Url", "https://*:5001"),
|
|
|
- new KeyValuePair<string, string>("Certificates:Default:Path", Path.Combine("shared", "TestCertificates", "https-aspnet.crt")),
|
|
|
- new KeyValuePair<string, string>("Certificates:Default:KeyPath", Path.Combine("shared", "TestCertificates", "https-aspnet.key"))
|
|
|
- }).Build();
|
|
|
+ new KeyValuePair<string, string>("Endpoints:End1:Url", "https://*:5001"),
|
|
|
+ new KeyValuePair<string, string>("Certificates:Default:Path", Path.Combine("shared", "TestCertificates", "https-aspnet.crt")),
|
|
|
+ new KeyValuePair<string, string>("Certificates:Default:KeyPath", Path.Combine("shared", "TestCertificates", "https-aspnet.key"))
|
|
|
+ }).Build();
|
|
|
|
|
|
var ex = Assert.Throws<ArgumentException>(() =>
|
|
|
{
|
|
|
@@ -286,11 +286,11 @@ public class KestrelConfigurationLoaderTests
|
|
|
|
|
|
var config = new ConfigurationBuilder().AddInMemoryCollection(new[]
|
|
|
{
|
|
|
- new KeyValuePair<string, string>("Endpoints:End1:Url", "https://*:5001"),
|
|
|
- new KeyValuePair<string, string>("Certificates:Default:Path", Path.Combine("shared", "TestCertificates", "https-aspnet.crt")),
|
|
|
- new KeyValuePair<string, string>("Certificates:Default:KeyPath", Path.Combine("shared", "TestCertificates", "https-ecdsa.key")),
|
|
|
- new KeyValuePair<string, string>("Certificates:Default:Password", "aspnetcore")
|
|
|
- }).Build();
|
|
|
+ new KeyValuePair<string, string>("Endpoints:End1:Url", "https://*:5001"),
|
|
|
+ new KeyValuePair<string, string>("Certificates:Default:Path", Path.Combine("shared", "TestCertificates", "https-aspnet.crt")),
|
|
|
+ new KeyValuePair<string, string>("Certificates:Default:KeyPath", Path.Combine("shared", "TestCertificates", "https-ecdsa.key")),
|
|
|
+ new KeyValuePair<string, string>("Certificates:Default:Password", "aspnetcore")
|
|
|
+ }).Build();
|
|
|
|
|
|
var ex = Assert.Throws<ArgumentException>(() =>
|
|
|
{
|
|
|
@@ -375,10 +375,10 @@ public class KestrelConfigurationLoaderTests
|
|
|
var ran1 = false;
|
|
|
var config = new ConfigurationBuilder().AddInMemoryCollection(new[]
|
|
|
{
|
|
|
- new KeyValuePair<string, string>("Endpoints:End1:Url", "https://*:5001"),
|
|
|
- new KeyValuePair<string, string>("Certificates:Default:Path", Path.Combine("shared", "TestCertificates", certificateFile)),
|
|
|
- new KeyValuePair<string, string>("Certificates:Default:KeyPath", Path.Combine("shared", "TestCertificates", certificateKey)),
|
|
|
- }
|
|
|
+ new KeyValuePair<string, string>("Endpoints:End1:Url", "https://*:5001"),
|
|
|
+ new KeyValuePair<string, string>("Certificates:Default:Path", Path.Combine("shared", "TestCertificates", certificateFile)),
|
|
|
+ new KeyValuePair<string, string>("Certificates:Default:KeyPath", Path.Combine("shared", "TestCertificates", certificateKey)),
|
|
|
+ }
|
|
|
.Concat(password != null ? new[] { new KeyValuePair<string, string>("Certificates:Default:Password", password) } : Array.Empty<KeyValuePair<string, string>>()))
|
|
|
.Build();
|
|
|
|
|
|
@@ -409,8 +409,8 @@ public class KestrelConfigurationLoaderTests
|
|
|
|
|
|
var config = new ConfigurationBuilder().AddInMemoryCollection(new[]
|
|
|
{
|
|
|
- new KeyValuePair<string, string>("Certificates:Development:Password", "12341234"),
|
|
|
- }).Build();
|
|
|
+ new KeyValuePair<string, string>("Certificates:Development:Password", "12341234"),
|
|
|
+ }).Build();
|
|
|
|
|
|
serverOptions
|
|
|
.Configure(config)
|
|
|
@@ -465,46 +465,46 @@ public class KestrelConfigurationLoaderTests
|
|
|
|
|
|
var config = new ConfigurationBuilder().AddInMemoryCollection(new[]
|
|
|
{
|
|
|
- new KeyValuePair<string, string>("Endpoints:End1:Url", "http://*:5001"),
|
|
|
- // We shouldn't need to specify a real cert, because KestrelConfigurationLoader should check whether the endpoint requires a cert before trying to load it.
|
|
|
- new KeyValuePair<string, string>("Endpoints:End1:Certificate:Path", "fakecert.pfx"),
|
|
|
- }).Build();
|
|
|
+ new KeyValuePair<string, string>("Endpoints:End1:Url", "http://*:5001"),
|
|
|
+ // We shouldn't need to specify a real cert, because KestrelConfigurationLoader should check whether the endpoint requires a cert before trying to load it.
|
|
|
+ new KeyValuePair<string, string>("Endpoints:End1:Certificate:Path", "fakecert.pfx"),
|
|
|
+ }).Build();
|
|
|
|
|
|
var ex = Assert.Throws<InvalidOperationException>(() => serverOptions.Configure(config).Load());
|
|
|
Assert.Equal(CoreStrings.FormatEndpointHasUnusedHttpsConfig("End1", "Certificate"), ex.Message);
|
|
|
|
|
|
config = new ConfigurationBuilder().AddInMemoryCollection(new[]
|
|
|
{
|
|
|
- new KeyValuePair<string, string>("Endpoints:End1:Url", "http://*:5001"),
|
|
|
- new KeyValuePair<string, string>("Endpoints:End1:Certificate:Subject", "example.org"),
|
|
|
- }).Build();
|
|
|
+ new KeyValuePair<string, string>("Endpoints:End1:Url", "http://*:5001"),
|
|
|
+ new KeyValuePair<string, string>("Endpoints:End1:Certificate:Subject", "example.org"),
|
|
|
+ }).Build();
|
|
|
|
|
|
ex = Assert.Throws<InvalidOperationException>(() => serverOptions.Configure(config).Load());
|
|
|
Assert.Equal(CoreStrings.FormatEndpointHasUnusedHttpsConfig("End1", "Certificate"), ex.Message);
|
|
|
|
|
|
config = new ConfigurationBuilder().AddInMemoryCollection(new[]
|
|
|
{
|
|
|
- new KeyValuePair<string, string>("Endpoints:End1:Url", "http://*:5001"),
|
|
|
- new KeyValuePair<string, string>("Endpoints:End1:ClientCertificateMode", ClientCertificateMode.RequireCertificate.ToString()),
|
|
|
- }).Build();
|
|
|
+ new KeyValuePair<string, string>("Endpoints:End1:Url", "http://*:5001"),
|
|
|
+ new KeyValuePair<string, string>("Endpoints:End1:ClientCertificateMode", ClientCertificateMode.RequireCertificate.ToString()),
|
|
|
+ }).Build();
|
|
|
|
|
|
ex = Assert.Throws<InvalidOperationException>(() => serverOptions.Configure(config).Load());
|
|
|
Assert.Equal(CoreStrings.FormatEndpointHasUnusedHttpsConfig("End1", "ClientCertificateMode"), ex.Message);
|
|
|
|
|
|
config = new ConfigurationBuilder().AddInMemoryCollection(new[]
|
|
|
{
|
|
|
- new KeyValuePair<string, string>("Endpoints:End1:Url", "http://*:5001"),
|
|
|
- new KeyValuePair<string, string>("Endpoints:End1:SslProtocols:0", SslProtocols.Tls13.ToString()),
|
|
|
- }).Build();
|
|
|
+ new KeyValuePair<string, string>("Endpoints:End1:Url", "http://*:5001"),
|
|
|
+ new KeyValuePair<string, string>("Endpoints:End1:SslProtocols:0", SslProtocols.Tls13.ToString()),
|
|
|
+ }).Build();
|
|
|
|
|
|
ex = Assert.Throws<InvalidOperationException>(() => serverOptions.Configure(config).Load());
|
|
|
Assert.Equal(CoreStrings.FormatEndpointHasUnusedHttpsConfig("End1", "SslProtocols"), ex.Message);
|
|
|
|
|
|
config = new ConfigurationBuilder().AddInMemoryCollection(new[]
|
|
|
{
|
|
|
- new KeyValuePair<string, string>("Endpoints:End1:Url", "http://*:5001"),
|
|
|
- new KeyValuePair<string, string>("Endpoints:End1:Sni:Protocols", HttpProtocols.Http1.ToString()),
|
|
|
- }).Build();
|
|
|
+ new KeyValuePair<string, string>("Endpoints:End1:Url", "http://*:5001"),
|
|
|
+ new KeyValuePair<string, string>("Endpoints:End1:Sni:Protocols", HttpProtocols.Http1.ToString()),
|
|
|
+ }).Build();
|
|
|
|
|
|
ex = Assert.Throws<InvalidOperationException>(() => serverOptions.Configure(config).Load());
|
|
|
Assert.Equal(CoreStrings.FormatEndpointHasUnusedHttpsConfig("End1", "Sni"), ex.Message);
|
|
|
@@ -517,9 +517,9 @@ public class KestrelConfigurationLoaderTests
|
|
|
|
|
|
var config = new ConfigurationBuilder().AddInMemoryCollection(new[]
|
|
|
{
|
|
|
- new KeyValuePair<string, string>("Endpoints:End1:Url", "http://*:5001"),
|
|
|
- new KeyValuePair<string, string>("EndpointDefaults:ClientCertificateMode", ClientCertificateMode.RequireCertificate.ToString()),
|
|
|
- }).Build();
|
|
|
+ new KeyValuePair<string, string>("Endpoints:End1:Url", "http://*:5001"),
|
|
|
+ new KeyValuePair<string, string>("EndpointDefaults:ClientCertificateMode", ClientCertificateMode.RequireCertificate.ToString()),
|
|
|
+ }).Build();
|
|
|
|
|
|
var (_, endpointsToStart) = serverOptions.Configure(config).Reload();
|
|
|
var end1 = Assert.Single(endpointsToStart);
|
|
|
@@ -580,9 +580,9 @@ public class KestrelConfigurationLoaderTests
|
|
|
var ran3 = false;
|
|
|
var config = new ConfigurationBuilder().AddInMemoryCollection(new[]
|
|
|
{
|
|
|
- new KeyValuePair<string, string>("EndpointDefaults:Protocols", input),
|
|
|
- new KeyValuePair<string, string>("Endpoints:End1:Url", "https://*:5001"),
|
|
|
- }).Build();
|
|
|
+ new KeyValuePair<string, string>("EndpointDefaults:Protocols", input),
|
|
|
+ new KeyValuePair<string, string>("Endpoints:End1:Url", "https://*:5001"),
|
|
|
+ }).Build();
|
|
|
serverOptions.Configure(config)
|
|
|
.Endpoint("End1", opt =>
|
|
|
{
|
|
|
@@ -650,9 +650,9 @@ public class KestrelConfigurationLoaderTests
|
|
|
var ran3 = false;
|
|
|
var config = new ConfigurationBuilder().AddInMemoryCollection(new[]
|
|
|
{
|
|
|
- new KeyValuePair<string, string>("Endpoints:End1:Protocols", input),
|
|
|
- new KeyValuePair<string, string>("Endpoints:End1:Url", "https://*:5001"),
|
|
|
- }).Build();
|
|
|
+ new KeyValuePair<string, string>("Endpoints:End1:Protocols", input),
|
|
|
+ new KeyValuePair<string, string>("Endpoints:End1:Url", "https://*:5001"),
|
|
|
+ }).Build();
|
|
|
serverOptions.Configure(config)
|
|
|
.Endpoint("End1", opt =>
|
|
|
{
|
|
|
@@ -701,13 +701,15 @@ public class KestrelConfigurationLoaderTests
|
|
|
var ran2 = false;
|
|
|
var config = new ConfigurationBuilder().AddInMemoryCollection(new[]
|
|
|
{
|
|
|
- new KeyValuePair<string, string>("Endpoints:End1:SslProtocols:0", "Tls11"),
|
|
|
- new KeyValuePair<string, string>("Endpoints:End1:Url", "https://*:5001"),
|
|
|
- }).Build();
|
|
|
+ new KeyValuePair<string, string>("Endpoints:End1:SslProtocols:0", "Tls11"),
|
|
|
+ new KeyValuePair<string, string>("Endpoints:End1:Url", "https://*:5001"),
|
|
|
+ }).Build();
|
|
|
serverOptions.Configure(config)
|
|
|
.Endpoint("End1", opt =>
|
|
|
{
|
|
|
+#pragma warning disable SYSLIB0039 // TLS 1.0 and 1.1 are obsolete
|
|
|
Assert.Equal(SslProtocols.Tls11, opt.HttpsOptions.SslProtocols);
|
|
|
+#pragma warning restore SYSLIB0039
|
|
|
ran1 = true;
|
|
|
})
|
|
|
.Load();
|
|
|
@@ -740,13 +742,15 @@ public class KestrelConfigurationLoaderTests
|
|
|
var ran1 = false;
|
|
|
var config = new ConfigurationBuilder().AddInMemoryCollection(new[]
|
|
|
{
|
|
|
- new KeyValuePair<string, string>("Endpoints:End1:SslProtocols:0", "Tls11"),
|
|
|
- new KeyValuePair<string, string>("Endpoints:End1:Url", "https://*:5001"),
|
|
|
- }).Build();
|
|
|
+ new KeyValuePair<string, string>("Endpoints:End1:SslProtocols:0", "Tls11"),
|
|
|
+ new KeyValuePair<string, string>("Endpoints:End1:Url", "https://*:5001"),
|
|
|
+ }).Build();
|
|
|
serverOptions.Configure(config)
|
|
|
.Endpoint("End1", opt =>
|
|
|
{
|
|
|
+#pragma warning disable SYSLIB0039 // TLS 1.0 and 1.1 are obsolete
|
|
|
Assert.Equal(SslProtocols.Tls11, opt.HttpsOptions.SslProtocols);
|
|
|
+#pragma warning restore SYSLIB0039
|
|
|
ran1 = true;
|
|
|
})
|
|
|
.Load();
|
|
|
@@ -767,13 +771,15 @@ public class KestrelConfigurationLoaderTests
|
|
|
var ran1 = false;
|
|
|
var config = new ConfigurationBuilder().AddInMemoryCollection(new[]
|
|
|
{
|
|
|
- new KeyValuePair<string, string>("EndpointDefaults:SslProtocols:0", "Tls11"),
|
|
|
- new KeyValuePair<string, string>("Endpoints:End1:Url", "https://*:5001"),
|
|
|
- }).Build();
|
|
|
+ new KeyValuePair<string, string>("EndpointDefaults:SslProtocols:0", "Tls11"),
|
|
|
+ new KeyValuePair<string, string>("Endpoints:End1:Url", "https://*:5001"),
|
|
|
+ }).Build();
|
|
|
serverOptions.Configure(config)
|
|
|
.Endpoint("End1", opt =>
|
|
|
{
|
|
|
+#pragma warning disable SYSLIB0039 // TLS 1.0 and 1.1 are obsolete
|
|
|
Assert.Equal(SslProtocols.Tls11, opt.HttpsOptions.SslProtocols);
|
|
|
+#pragma warning restore SYSLIB0039
|
|
|
ran1 = true;
|
|
|
})
|
|
|
.Load();
|
|
|
@@ -790,16 +796,18 @@ public class KestrelConfigurationLoaderTests
|
|
|
{
|
|
|
opt.ServerCertificate = TestResources.GetTestCertificate();
|
|
|
|
|
|
+#pragma warning disable SYSLIB0039 // TLS 1.0 and 1.1 are obsolete
|
|
|
Assert.Equal(SslProtocols.Tls11, opt.SslProtocols);
|
|
|
+#pragma warning restore SYSLIB0039
|
|
|
opt.SslProtocols = SslProtocols.Tls12;
|
|
|
});
|
|
|
|
|
|
var ran1 = false;
|
|
|
var config = new ConfigurationBuilder().AddInMemoryCollection(new[]
|
|
|
{
|
|
|
- new KeyValuePair<string, string>("EndpointDefaults:SslProtocols:0", "Tls11"),
|
|
|
- new KeyValuePair<string, string>("Endpoints:End1:Url", "https://*:5001"),
|
|
|
- }).Build();
|
|
|
+ new KeyValuePair<string, string>("EndpointDefaults:SslProtocols:0", "Tls11"),
|
|
|
+ new KeyValuePair<string, string>("Endpoints:End1:Url", "https://*:5001"),
|
|
|
+ }).Build();
|
|
|
serverOptions.Configure(config)
|
|
|
.Endpoint("End1", opt =>
|
|
|
{
|
|
|
@@ -830,9 +838,9 @@ public class KestrelConfigurationLoaderTests
|
|
|
var ran2 = false;
|
|
|
var config = new ConfigurationBuilder().AddInMemoryCollection(new[]
|
|
|
{
|
|
|
- new KeyValuePair<string, string>("Endpoints:End1:ClientCertificateMode", "AllowCertificate"),
|
|
|
- new KeyValuePair<string, string>("Endpoints:End1:Url", "https://*:5001"),
|
|
|
- }).Build();
|
|
|
+ new KeyValuePair<string, string>("Endpoints:End1:ClientCertificateMode", "AllowCertificate"),
|
|
|
+ new KeyValuePair<string, string>("Endpoints:End1:Url", "https://*:5001"),
|
|
|
+ }).Build();
|
|
|
serverOptions.Configure(config)
|
|
|
.Endpoint("End1", opt =>
|
|
|
{
|
|
|
@@ -864,13 +872,13 @@ public class KestrelConfigurationLoaderTests
|
|
|
|
|
|
var config = new ConfigurationBuilder().AddInMemoryCollection(new[]
|
|
|
{
|
|
|
- new KeyValuePair<string, string>("Endpoints:End1:Url", "https://*:5001"),
|
|
|
- new KeyValuePair<string, string>("Endpoints:End1:Sni:*.example.org:Protocols", HttpProtocols.None.ToString()),
|
|
|
- new KeyValuePair<string, string>("Endpoints:End1:Sni:*.example.org:SslProtocols:0", SslProtocols.Tls13.ToString()),
|
|
|
- new KeyValuePair<string, string>("Endpoints:End1:Sni:*.example.org:ClientCertificateMode", ClientCertificateMode.RequireCertificate.ToString()),
|
|
|
- new KeyValuePair<string, string>("Endpoints:End1:Sni:*.example.org:Certificate:Path", certPath),
|
|
|
- new KeyValuePair<string, string>("Endpoints:End1:Sni:*.example.org:Certificate:KeyPath", keyPath),
|
|
|
- }).Build();
|
|
|
+ new KeyValuePair<string, string>("Endpoints:End1:Url", "https://*:5001"),
|
|
|
+ new KeyValuePair<string, string>("Endpoints:End1:Sni:*.example.org:Protocols", HttpProtocols.None.ToString()),
|
|
|
+ new KeyValuePair<string, string>("Endpoints:End1:Sni:*.example.org:SslProtocols:0", SslProtocols.Tls13.ToString()),
|
|
|
+ new KeyValuePair<string, string>("Endpoints:End1:Sni:*.example.org:ClientCertificateMode", ClientCertificateMode.RequireCertificate.ToString()),
|
|
|
+ new KeyValuePair<string, string>("Endpoints:End1:Sni:*.example.org:Certificate:Path", certPath),
|
|
|
+ new KeyValuePair<string, string>("Endpoints:End1:Sni:*.example.org:Certificate:KeyPath", keyPath),
|
|
|
+ }).Build();
|
|
|
|
|
|
var (_, endpointsToStart) = serverOptions.Configure(config).Reload();
|
|
|
var end1 = Assert.Single(endpointsToStart);
|
|
|
@@ -925,9 +933,9 @@ public class KestrelConfigurationLoaderTests
|
|
|
var ran1 = false;
|
|
|
var config = new ConfigurationBuilder().AddInMemoryCollection(new[]
|
|
|
{
|
|
|
- new KeyValuePair<string, string>("EndpointDefaults:ClientCertificateMode", "AllowCertificate"),
|
|
|
- new KeyValuePair<string, string>("Endpoints:End1:Url", "https://*:5001"),
|
|
|
- }).Build();
|
|
|
+ new KeyValuePair<string, string>("EndpointDefaults:ClientCertificateMode", "AllowCertificate"),
|
|
|
+ new KeyValuePair<string, string>("Endpoints:End1:Url", "https://*:5001"),
|
|
|
+ }).Build();
|
|
|
serverOptions.Configure(config)
|
|
|
.Endpoint("End1", opt =>
|
|
|
{
|
|
|
@@ -955,9 +963,9 @@ public class KestrelConfigurationLoaderTests
|
|
|
var ran1 = false;
|
|
|
var config = new ConfigurationBuilder().AddInMemoryCollection(new[]
|
|
|
{
|
|
|
- new KeyValuePair<string, string>("EndpointDefaults:ClientCertificateMode", "AllowCertificate"),
|
|
|
- new KeyValuePair<string, string>("Endpoints:End1:Url", "https://*:5001"),
|
|
|
- }).Build();
|
|
|
+ new KeyValuePair<string, string>("EndpointDefaults:ClientCertificateMode", "AllowCertificate"),
|
|
|
+ new KeyValuePair<string, string>("Endpoints:End1:Url", "https://*:5001"),
|
|
|
+ }).Build();
|
|
|
serverOptions.Configure(config)
|
|
|
.Endpoint("End1", opt =>
|
|
|
{
|
|
|
@@ -976,9 +984,9 @@ public class KestrelConfigurationLoaderTests
|
|
|
|
|
|
var config = new ConfigurationBuilder().AddInMemoryCollection(new[]
|
|
|
{
|
|
|
- new KeyValuePair<string, string>("Endpoints:A:Url", "http://*:5000"),
|
|
|
- new KeyValuePair<string, string>("Endpoints:B:Url", "http://*:5001"),
|
|
|
- }).Build();
|
|
|
+ new KeyValuePair<string, string>("Endpoints:A:Url", "http://*:5000"),
|
|
|
+ new KeyValuePair<string, string>("Endpoints:B:Url", "http://*:5001"),
|
|
|
+ }).Build();
|
|
|
|
|
|
serverOptions.Configure(config).Load();
|
|
|
|
|
|
@@ -988,10 +996,10 @@ public class KestrelConfigurationLoaderTests
|
|
|
|
|
|
serverOptions.ConfigurationLoader.Configuration = new ConfigurationBuilder().AddInMemoryCollection(new[]
|
|
|
{
|
|
|
- new KeyValuePair<string, string>("Endpoints:A:Url", "http://*:5000"),
|
|
|
- new KeyValuePair<string, string>("Endpoints:B:Url", "http://*:5002"),
|
|
|
- new KeyValuePair<string, string>("Endpoints:C:Url", "http://*:5003"),
|
|
|
- }).Build();
|
|
|
+ new KeyValuePair<string, string>("Endpoints:A:Url", "http://*:5000"),
|
|
|
+ new KeyValuePair<string, string>("Endpoints:B:Url", "http://*:5002"),
|
|
|
+ new KeyValuePair<string, string>("Endpoints:C:Url", "http://*:5003"),
|
|
|
+ }).Build();
|
|
|
|
|
|
var (endpointsToStop, endpointsToStart) = serverOptions.ConfigurationLoader.Reload();
|
|
|
|
|
|
@@ -1015,20 +1023,20 @@ public class KestrelConfigurationLoaderTests
|
|
|
|
|
|
var config = new ConfigurationBuilder().AddInMemoryCollection(new[]
|
|
|
{
|
|
|
- new KeyValuePair<string, string>("Endpoints:DefaultProtocol:Url", "http://*:5000"),
|
|
|
- new KeyValuePair<string, string>("Endpoints:NonDefaultProtocol:Url", "http://*:5001"),
|
|
|
- new KeyValuePair<string, string>("Endpoints:NonDefaultProtocol:Protocols", "Http1AndHttp2"),
|
|
|
- }).Build();
|
|
|
+ new KeyValuePair<string, string>("Endpoints:DefaultProtocol:Url", "http://*:5000"),
|
|
|
+ new KeyValuePair<string, string>("Endpoints:NonDefaultProtocol:Url", "http://*:5001"),
|
|
|
+ new KeyValuePair<string, string>("Endpoints:NonDefaultProtocol:Protocols", "Http1AndHttp2"),
|
|
|
+ }).Build();
|
|
|
|
|
|
serverOptions.Configure(config).Load();
|
|
|
|
|
|
serverOptions.ConfigurationLoader.Configuration = new ConfigurationBuilder().AddInMemoryCollection(new[]
|
|
|
{
|
|
|
- new KeyValuePair<string, string>("Endpoints:DefaultProtocol:Url", "http://*:5000"),
|
|
|
- new KeyValuePair<string, string>("Endpoints:NonDefaultProtocol:Url", "http://*:5001"),
|
|
|
- new KeyValuePair<string, string>("Endpoints:NonDefaultProtocol:Protocols", "Http1AndHttp2"),
|
|
|
- new KeyValuePair<string, string>("EndpointDefaults:Protocols", "Http1"),
|
|
|
- }).Build();
|
|
|
+ new KeyValuePair<string, string>("Endpoints:DefaultProtocol:Url", "http://*:5000"),
|
|
|
+ new KeyValuePair<string, string>("Endpoints:NonDefaultProtocol:Url", "http://*:5001"),
|
|
|
+ new KeyValuePair<string, string>("Endpoints:NonDefaultProtocol:Protocols", "Http1AndHttp2"),
|
|
|
+ new KeyValuePair<string, string>("EndpointDefaults:Protocols", "Http1"),
|
|
|
+ }).Build();
|
|
|
|
|
|
var (endpointsToStop, endpointsToStart) = serverOptions.ConfigurationLoader.Reload();
|
|
|
|
|
|
@@ -1050,9 +1058,9 @@ public class KestrelConfigurationLoaderTests
|
|
|
|
|
|
var config = new ConfigurationBuilder().AddInMemoryCollection(new[]
|
|
|
{
|
|
|
- new KeyValuePair<string, string>("Endpoints:Changed:Url", "http://*:5001"),
|
|
|
- new KeyValuePair<string, string>("Endpoints:Unchanged:Url", "http://*:5000"),
|
|
|
- }).Build();
|
|
|
+ new KeyValuePair<string, string>("Endpoints:Changed:Url", "http://*:5001"),
|
|
|
+ new KeyValuePair<string, string>("Endpoints:Unchanged:Url", "http://*:5000"),
|
|
|
+ }).Build();
|
|
|
|
|
|
serverOptions.Configure(config)
|
|
|
.Endpoint("Changed", endpointOptions => foundChangedCount++)
|
|
|
@@ -1065,9 +1073,9 @@ public class KestrelConfigurationLoaderTests
|
|
|
|
|
|
serverOptions.ConfigurationLoader.Configuration = new ConfigurationBuilder().AddInMemoryCollection(new[]
|
|
|
{
|
|
|
- new KeyValuePair<string, string>("Endpoints:Changed:Url", "http://*:5002"),
|
|
|
- new KeyValuePair<string, string>("Endpoints:Unchanged:Url", "http://*:5000"),
|
|
|
- }).Build();
|
|
|
+ new KeyValuePair<string, string>("Endpoints:Changed:Url", "http://*:5002"),
|
|
|
+ new KeyValuePair<string, string>("Endpoints:Unchanged:Url", "http://*:5000"),
|
|
|
+ }).Build();
|
|
|
|
|
|
serverOptions.ConfigurationLoader.Reload();
|
|
|
|