diff options
author | wolfbeast <mcwerewolf@gmail.com> | 2018-02-23 12:41:54 +0100 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-02-23 12:41:54 +0100 |
commit | b884cfd05e35ba96f26a864408d9cd67b913a13b (patch) | |
tree | 7b8800f6bf2b9354a4a93768f76283203e6d2233 | |
parent | a910f57af64271e391c1fb33cbdd97da1ddfe2d6 (diff) | |
parent | 2625cde90f5174cf9eb83b1176bb041cdeb51967 (diff) | |
download | UXP-b884cfd05e35ba96f26a864408d9cd67b913a13b.tar UXP-b884cfd05e35ba96f26a864408d9cd67b913a13b.tar.gz UXP-b884cfd05e35ba96f26a864408d9cd67b913a13b.tar.lz UXP-b884cfd05e35ba96f26a864408d9cd67b913a13b.tar.xz UXP-b884cfd05e35ba96f26a864408d9cd67b913a13b.zip |
Merge branch '_native_52ESR_http_events_1' into TLS-1.3
-rw-r--r-- | netwerk/protocol/http/nsHttpTransaction.cpp | 47 | ||||
-rw-r--r-- | netwerk/protocol/http/nsHttpTransaction.h | 2 |
2 files changed, 49 insertions, 0 deletions
diff --git a/netwerk/protocol/http/nsHttpTransaction.cpp b/netwerk/protocol/http/nsHttpTransaction.cpp index ee3a88489..7c0c7f87d 100644 --- a/netwerk/protocol/http/nsHttpTransaction.cpp +++ b/netwerk/protocol/http/nsHttpTransaction.cpp @@ -144,6 +144,7 @@ nsHttpTransaction::nsHttpTransaction() , mIsInIsolatedMozBrowser(false) , mClassOfService(0) , m0RTTInProgress(false) + , mTransportStatus(NS_OK) { LOG(("Creating nsHttpTransaction @%p\n", this)); gHttpHandler->GetMaxPipelineObjectSize(&mMaxPipelineObjectSize); @@ -550,6 +551,50 @@ nsHttpTransaction::OnTransportStatus(nsITransport* transport, LOG(("nsHttpTransaction::OnSocketStatus [this=%p status=%x progress=%lld]\n", this, status, progress)); + // A transaction can given to multiple HalfOpen sockets (this is a bug in + // nsHttpConnectionMgr). We are going to fix it here as a work around to be + // able to uplift it. + switch(status) { + case NS_NET_STATUS_RESOLVING_HOST: + if (mTransportStatus != NS_OK) { + LOG(("nsHttpTransaction::OnSocketStatus - ignore socket events " + "from backup transport")); + return; + } + break; + case NS_NET_STATUS_RESOLVED_HOST: + if (mTransportStatus != NS_NET_STATUS_RESOLVING_HOST && + mTransportStatus != NS_OK) { + LOG(("nsHttpTransaction::OnSocketStatus - ignore socket events " + "from backup transport")); + return; + } + break; + case NS_NET_STATUS_CONNECTING_TO: + if (mTransportStatus != NS_NET_STATUS_RESOLVING_HOST && + mTransportStatus != NS_NET_STATUS_RESOLVED_HOST && + mTransportStatus != NS_OK) { + LOG(("nsHttpTransaction::OnSocketStatus - ignore socket events " + "from backup transport")); + return; + } + break; + case NS_NET_STATUS_CONNECTED_TO: + if (mTransportStatus != NS_NET_STATUS_RESOLVING_HOST && + mTransportStatus != NS_NET_STATUS_RESOLVED_HOST && + mTransportStatus != NS_NET_STATUS_CONNECTING_TO && + mTransportStatus != NS_OK) { + LOG(("nsHttpTransaction::OnSocketStatus - ignore socket events " + "from backup transport")); + return; + } + break; + default: + LOG(("nsHttpTransaction::OnSocketStatus - a new event")); + } + + mTransportStatus = status; + if (status == NS_NET_STATUS_CONNECTED_TO || status == NS_NET_STATUS_WAITING_FOR) { nsISocketTransport *socketTransport = @@ -1327,6 +1372,8 @@ nsHttpTransaction::Restart() } } + mTransportStatus = NS_OK; + return gHttpHandler->InitiateTransaction(this, mPriority); } diff --git a/netwerk/protocol/http/nsHttpTransaction.h b/netwerk/protocol/http/nsHttpTransaction.h index ab0b267a7..18b2693ec 100644 --- a/netwerk/protocol/http/nsHttpTransaction.h +++ b/netwerk/protocol/http/nsHttpTransaction.h @@ -479,6 +479,8 @@ private: NetAddr mPeerAddr; bool m0RTTInProgress; + + nsresult mTransportStatus; }; } // namespace net |