Bug 1527005 - WebSocketChannel hangs waiting for OnTransportAvailable when server responds to upgrade request with HTTP/1.0, r=dragana
authorMichal Novotny <michal.novotny>
Mon, 11 Feb 2019 10:11:00 +0200
changeset 458702 609114233603
parent 458701 2161b075ce64
child 458703 c849fb69e2e7
child 458705 cbbdfdbbe0ab
push id35544
push userccoroiu@mozilla.com
push dateTue, 12 Feb 2019 16:29:08 +0000
treeherdermozilla-central@c849fb69e2e7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdragana
bugs1527005
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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.
netwerk/protocol/websocket/WebSocketChannel.cpp
--- a/netwerk/protocol/websocket/WebSocketChannel.cpp
+++ b/netwerk/protocol/websocket/WebSocketChannel.cpp
@@ -3694,17 +3694,18 @@ WebSocketChannel::OnStartRequest(nsIRequ
     return rv;
   }
 
   LOG(("WebSocketChannel::OnStartRequest: HTTP status %d\n", status));
   nsCOMPtr<nsIHttpChannelInternal> internalChannel =
       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);
     return NS_ERROR_CONNECTION_REFUSED;
   }
 
   if (versionMajor == 1) {
     // These are only present on http/1.x websocket upgrades