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
This commit is contained in:
Michal Novotny 2019-02-11 10:11:00 +02:00
parent 88ffa67e55
commit 126cc12cee

View File

@ -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);