@@ -1176,40 +1176,43 @@ private void SetSessionHandleTlsOptions(SafeWinHttpHandle sessionHandle)
1176
1176
{
1177
1177
const SslProtocols Tls13 = ( SslProtocols ) 12288 ; // enum is missing in .NET Standard
1178
1178
uint optionData = 0 ;
1179
- SslProtocols sslProtocols =
1180
- ( _sslProtocols == SslProtocols . None ) ? SecurityProtocol . DefaultSecurityProtocols : _sslProtocols ;
1179
+
1180
+ if ( _sslProtocols == SslProtocols . None )
1181
+ {
1182
+ return ;
1183
+ }
1181
1184
1182
1185
#pragma warning disable 0618 // SSL2/SSL3 are deprecated
1183
- if ( ( sslProtocols & SslProtocols . Ssl2 ) != 0 )
1186
+ if ( ( _sslProtocols & SslProtocols . Ssl2 ) != 0 )
1184
1187
{
1185
1188
optionData |= Interop . WinHttp . WINHTTP_FLAG_SECURE_PROTOCOL_SSL2 ;
1186
1189
}
1187
1190
1188
- if ( ( sslProtocols & SslProtocols . Ssl3 ) != 0 )
1191
+ if ( ( _sslProtocols & SslProtocols . Ssl3 ) != 0 )
1189
1192
{
1190
1193
optionData |= Interop . WinHttp . WINHTTP_FLAG_SECURE_PROTOCOL_SSL3 ;
1191
1194
}
1192
1195
#pragma warning restore 0618
1193
1196
1194
1197
#pragma warning disable SYSLIB0039 // TLS 1.0 and 1.1 are obsolete
1195
- if ( ( sslProtocols & SslProtocols . Tls ) != 0 )
1198
+ if ( ( _sslProtocols & SslProtocols . Tls ) != 0 )
1196
1199
{
1197
1200
optionData |= Interop . WinHttp . WINHTTP_FLAG_SECURE_PROTOCOL_TLS1 ;
1198
1201
}
1199
1202
1200
- if ( ( sslProtocols & SslProtocols . Tls11 ) != 0 )
1203
+ if ( ( _sslProtocols & SslProtocols . Tls11 ) != 0 )
1201
1204
{
1202
1205
optionData |= Interop . WinHttp . WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_1 ;
1203
1206
}
1204
1207
#pragma warning restore SYSLIB0039
1205
1208
1206
- if ( ( sslProtocols & SslProtocols . Tls12 ) != 0 )
1209
+ if ( ( _sslProtocols & SslProtocols . Tls12 ) != 0 )
1207
1210
{
1208
1211
optionData |= Interop . WinHttp . WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_2 ;
1209
1212
}
1210
1213
1211
1214
// Set this only if supported by WinHttp version.
1212
- if ( s_supportsTls13 . Value && ( sslProtocols & Tls13 ) != 0 )
1215
+ if ( s_supportsTls13 . Value && ( _sslProtocols & Tls13 ) != 0 )
1213
1216
{
1214
1217
optionData |= Interop . WinHttp . WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_3 ;
1215
1218
}
0 commit comments