Skip to content

Commit 5729989

Browse files
authored
Update CloneSslOptionsClonesAllProperties test
New properties got added in dotnet/runtime#114741
1 parent 2b82b09 commit 5729989

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,10 @@ internal static SslServerAuthenticationOptions CloneSslOptions(SslServerAuthenti
200200
ServerCertificateSelectionCallback = sslOptions.ServerCertificateSelectionCallback,
201201
CertificateChainPolicy = sslOptions.CertificateChainPolicy,
202202
AllowTlsResume = sslOptions.AllowTlsResume,
203+
#pragma warning disable CA1416 // Ignore SupportedOSPlatform checks, we're just copying the value
204+
AllowRsaPssPadding = sslOptions.AllowRsaPssPadding,
205+
AllowRsaPkcs1Padding = sslOptions.AllowRsaPkcs1Padding,
206+
#pragma warning restore CA1416
203207
};
204208

205209
private sealed class SniOptions

src/Servers/Kestrel/Core/test/SniOptionsSelectorTests.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -858,6 +858,12 @@ public void CloneSslOptionsClonesAllProperties()
858858
CertificateChainPolicy = new X509ChainPolicy(),
859859
// Defaults to true
860860
AllowTlsResume = false,
861+
#pragma warning disable CA1416
862+
// Defaults to true
863+
AllowRsaPssPadding = false,
864+
// Defaults to true
865+
AllowRsaPkcs1Padding = false,
866+
#pragma warning restore CA1416
861867
};
862868

863869
var clonedOptions = SniOptionsSelector.CloneSslOptions(options);
@@ -906,6 +912,12 @@ public void CloneSslOptionsClonesAllProperties()
906912
Assert.Equal(options.AllowTlsResume, clonedOptions.AllowTlsResume);
907913
Assert.True(propertyNames.Remove(nameof(options.AllowTlsResume)));
908914

915+
Assert.Equal(options.AllowRsaPssPadding, clonedOptions.AllowRsaPssPadding);
916+
Assert.True(propertyNames.Remove(nameof(options.AllowRsaPssPadding)));
917+
918+
Assert.Equal(options.AllowRsaPkcs1Padding, clonedOptions.AllowRsaPkcs1Padding);
919+
Assert.True(propertyNames.Remove(nameof(options.AllowRsaPkcs1Padding)));
920+
909921
// Ensure we've checked every property. When new properties get added, we'll have to update this test along with the CloneSslOptions implementation.
910922
Assert.Empty(propertyNames);
911923
}

0 commit comments

Comments
 (0)