diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-08 15:11:26 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-08 15:11:26 +0000 |
commit | fcea19dfd2c426bac0456da850e7c12258e4b9eb (patch) | |
tree | a31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /netwerk/protocol/http/nsHttpConnection.cpp | |
parent | Adding upstream version 115.7.0esr. (diff) | |
download | firefox-esr-fcea19dfd2c426bac0456da850e7c12258e4b9eb.tar.xz firefox-esr-fcea19dfd2c426bac0456da850e7c12258e4b9eb.zip |
Adding upstream version 115.8.0esr.upstream/115.8.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'netwerk/protocol/http/nsHttpConnection.cpp')
-rw-r--r-- | netwerk/protocol/http/nsHttpConnection.cpp | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/netwerk/protocol/http/nsHttpConnection.cpp b/netwerk/protocol/http/nsHttpConnection.cpp index 07ca208acd..152a8348b4 100644 --- a/netwerk/protocol/http/nsHttpConnection.cpp +++ b/netwerk/protocol/http/nsHttpConnection.cpp @@ -989,8 +989,11 @@ nsresult nsHttpConnection::OnHeadersAvailable(nsAHttpTransaction* trans, case HttpConnectionState::SETTING_UP_TUNNEL: { nsHttpTransaction* trans = mTransaction->QueryHttpTransaction(); // Distinguish SETTING_UP_TUNNEL for proxy or websocket via proxy + // See bug 1848013. Do not call HandleTunnelResponse for a tunnel + // connection created for WebSocket. if (trans && trans->IsWebsocketUpgrade() && - trans->GetProxyConnectResponseCode() == 200) { + (trans->GetProxyConnectResponseCode() == 200 || + (mForWebSocket && mInSpdyTunnel))) { HandleWebSocketResponse(requestHead, responseHead, responseStatus); } else { HandleTunnelResponse(responseStatus, reset); @@ -1894,6 +1897,23 @@ nsresult nsHttpConnection::MakeConnectString(nsAHttpTransaction* trans, request->SetRequestURI(requestURI); request->SetHTTPS(trans->RequestHead()->IsHTTPS()); + + nsAutoCString val; + if (NS_SUCCEEDED(trans->RequestHead()->GetHeader( + nsHttp::Sec_WebSocket_Extensions, val))) { + rv = request->SetHeader(nsHttp::Sec_WebSocket_Extensions, val); + MOZ_ASSERT(NS_SUCCEEDED(rv)); + } + if (NS_SUCCEEDED(trans->RequestHead()->GetHeader( + nsHttp::Sec_WebSocket_Protocol, val))) { + rv = request->SetHeader(nsHttp::Sec_WebSocket_Protocol, val); + MOZ_ASSERT(NS_SUCCEEDED(rv)); + } + if (NS_SUCCEEDED(trans->RequestHead()->GetHeader( + nsHttp::Sec_WebSocket_Version, val))) { + rv = request->SetHeader(nsHttp::Sec_WebSocket_Version, val); + MOZ_ASSERT(NS_SUCCEEDED(rv)); + } } else { request->SetRequestURI(result); } @@ -1934,8 +1954,8 @@ nsresult nsHttpConnection::MakeConnectString(nsAHttpTransaction* trans, request->Flatten(result, false); if (LOG1_ENABLED()) { - LOG(("nsHttpConnection::MakeConnectString for transaction=%p [", - trans->QueryHttpTransaction())); + LOG(("nsHttpConnection::MakeConnectString for transaction=%p h2ws=%d[", + trans->QueryHttpTransaction(), h2ws)); LogHeaders(result.BeginReading()); LOG(("]")); } @@ -2522,7 +2542,8 @@ nsresult nsHttpConnection::SetupProxyConnectStream() { nsAutoCString buf; nsHttpRequestHead request; - nsresult rv = MakeConnectString(mTransaction, &request, buf, false, + nsresult rv = MakeConnectString(mTransaction, &request, buf, + mForWebSocket && mInSpdyTunnel, mTransactionCaps & NS_HTTP_USE_RFP); if (NS_FAILED(rv)) { return rv; |