[http] Use a copy of nsHttpConnectionInfo.

master
Fedor 2020-11-26 05:42:14 +02:00
parent 8391e57b27
commit c06c3fab9b
2 changed files with 8 additions and 7 deletions

View File

@ -3531,17 +3531,18 @@ Http2Session::UnRegisterTunnel(Http2Stream *aTunnel)
} }
void void
Http2Session::CreateTunnel(nsHttpTransaction *trans, Http2Session::CreateTunnel(nsHttpTransaction* trans,
nsHttpConnectionInfo *ci, nsHttpConnectionInfo* ci,
nsIInterfaceRequestor *aCallbacks) nsIInterfaceRequestor* aCallbacks)
{ {
LOG(("Http2Session::CreateTunnel %p %p make new tunnel\n", this, trans)); LOG(("Http2Session::CreateTunnel %p %p make new tunnel\n", this, trans));
// The connect transaction will hold onto the underlying http // The connect transaction will hold onto the underlying http
// transaction so that an auth created by the connect can be mappped // transaction so that an auth created by the connect can be mappped
// to the correct security callbacks // to the correct security callbacks
RefPtr<nsHttpConnectionInfo> clone(ci->Clone());
RefPtr<SpdyConnectTransaction> connectTrans = RefPtr<SpdyConnectTransaction> connectTrans =
new SpdyConnectTransaction(ci, aCallbacks, trans->Caps(), trans, this); new SpdyConnectTransaction(clone, aCallbacks, trans->Caps(), trans, this);
AddStream(connectTrans, nsISupportsPriority::PRIORITY_NORMAL, false, nullptr); AddStream(connectTrans, nsISupportsPriority::PRIORITY_NORMAL, false, nullptr);
Http2Stream *tunnel = mStreamTransactionHash.Get(connectTrans); Http2Stream *tunnel = mStreamTransactionHash.Get(connectTrans);
MOZ_ASSERT(tunnel); MOZ_ASSERT(tunnel);

View File

@ -2030,9 +2030,9 @@ nsHttpTransaction::DisableSpdy()
{ {
mCaps |= NS_HTTP_DISALLOW_SPDY; mCaps |= NS_HTTP_DISALLOW_SPDY;
if (mConnInfo) { if (mConnInfo) {
// This is our clone of the connection info, not the persistent one that RefPtr<nsHttpConnectionInfo> connInfo = mConnInfo->Clone();
// is owned by the connection manager, so we're safe to change this here connInfo->SetNoSpdy(true);
mConnInfo->SetNoSpdy(true); mConnInfo.swap(connInfo);
} }
} }