Skip to content

Commit 5ef0a30

Browse files
authored
update CreateHttpClient condition
1 parent a03bff1 commit 5ef0a30

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/SignalR/clients/csharp/Http.Connections.Client/src/HttpConnection.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -549,14 +549,14 @@ private async Task StartTransport(Uri connectUrl, HttpTransportType transportTyp
549549

550550
private HttpClient? CreateHttpClient()
551551
{
552-
var clientWebSocketOptions = new ClientWebSocketOptions();
553-
_httpConnectionOptions.WebSocketConfiguration?.Invoke(clientWebSocketOptions);
554552
if (_httpConnectionOptions.SkipNegotiation
555-
&& _httpConnectionOptions.Transports == HttpTransportType.WebSockets
556-
&& clientWebSocketOptions.HttpVersion < HttpVersion.Version20
553+
&& _httpConnectionOptions.Transports == HttpTransportType.WebSockets`
557554
)
558555
{
559-
return null;
556+
var clientWebSocket = new System.Net.WebSockets.ClientWebSocket();
557+
_httpConnectionOptions.WebSocketConfiguration?.Invoke(clientWebSocket.Options);
558+
if (clientWebSocket.Options.HttpVersion < System.Net.HttpVersion.Version20)
559+
return null;
560560
}
561561

562562
var httpClientHandler = new HttpClientHandler();

0 commit comments

Comments
 (0)