From 126cc12ceecc3f065e5b81e980a51bdb27057345 Mon Sep 17 00:00:00 2001 From: Michal Novotny Date: Mon, 11 Feb 2019 10:11:00 +0200 Subject: [PATCH] Bug 1527005 - WebSocketChannel hangs waiting for OnTransportAvailable when server responds to upgrade request with HTTP/1.0, r=dragana We must fail if server responds with HTTP/1.0 because HTTP upgrade requires at least HTTP/1.1 and nsHttpChannel correctly won't perform the upgrade, i.e WebSocketChannel::OnTransportAvailable won't be called. --HG-- extra : rebase_source : a5af566c8a8dfc5e50aa74fcc1f0e552937e4b4e --- netwerk/protocol/websocket/WebSocketChannel.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/netwerk/protocol/websocket/WebSocketChannel.cpp b/netwerk/protocol/websocket/WebSocketChannel.cpp index 1f2e85cc1f3d..0712eb23f131 100644 --- a/netwerk/protocol/websocket/WebSocketChannel.cpp +++ b/netwerk/protocol/websocket/WebSocketChannel.cpp @@ -3699,7 +3699,8 @@ WebSocketChannel::OnStartRequest(nsIRequest *aRequest, nsISupports *aContext) { do_QueryInterface(mHttpChannel); uint32_t versionMajor, versionMinor; rv = internalChannel->GetResponseVersion(&versionMajor, &versionMinor); - if (NS_FAILED(rv) || (versionMajor != 1 && versionMajor != 2) || + if (NS_FAILED(rv) || + !((versionMajor == 1 && versionMinor != 0) || versionMajor == 2) || (versionMajor == 1 && status != 101) || (versionMajor == 2 && status != 200)) { AbortSession(NS_ERROR_CONNECTION_REFUSED);