Bug 1475420 - mark the TRR connection as DISABLE_TRR to avoid TXT deadlock r=bagder
MozReview-Commit-ID: 3xF3Hb5rpyh
--- a/netwerk/protocol/http/nsHttp.h
+++ b/netwerk/protocol/http/nsHttp.h
@@ -102,16 +102,20 @@ namespace net {
// Transactions with this flag should be processed first.
#define NS_HTTP_URGENT_START (1<<12)
// A sticky connection of the transaction is explicitly allowed to be restarted
// on ERROR_NET_RESET.
#define NS_HTTP_CONNECTION_RESTARTABLE (1<<13)
+// Disallow name resolutions for this transaction to use TRR - primarily
+// for use with TRR implementations themselves
+#define NS_HTTP_DISABLE_TRR (1<<14)
+
//-----------------------------------------------------------------------------
// some default values
//-----------------------------------------------------------------------------
#define NS_HTTP_DEFAULT_PORT 80
#define NS_HTTPS_DEFAULT_PORT 443
#define NS_HTTP_HEADER_SEPS ", \t"
--- a/netwerk/protocol/http/nsHttpChannel.cpp
+++ b/netwerk/protocol/http/nsHttpChannel.cpp
@@ -496,16 +496,20 @@ nsHttpChannel::OnBeforeConnect()
// ensure that we are using a valid hostname
if (!net_IsValidHostName(nsDependentCString(mConnectionInfo->Origin())))
return NS_ERROR_UNKNOWN_HOST;
if (mUpgradeProtocolCallback) {
mCaps |= NS_HTTP_DISALLOW_SPDY;
}
+ if (mTRR) {
+ mCaps |= NS_HTTP_LARGE_KEEPALIVE | NS_HTTP_DISABLE_TRR;
+ }
+
// Finalize ConnectionInfo flags before SpeculativeConnect
mConnectionInfo->SetAnonymous((mLoadFlags & LOAD_ANONYMOUS) != 0);
mConnectionInfo->SetPrivate(mPrivateBrowsing);
mConnectionInfo->SetNoSpdy(mCaps & NS_HTTP_DISALLOW_SPDY);
mConnectionInfo->SetBeConservative((mCaps & NS_HTTP_BE_CONSERVATIVE) || mBeConservative);
mConnectionInfo->SetTlsFlags(mTlsFlags);
// notify "http-on-before-connect" observers
@@ -753,17 +757,18 @@ nsHttpChannel::SpeculativeConnect()
nsCOMPtr<nsIInterfaceRequestor> callbacks;
NS_NewNotificationCallbacksAggregation(mCallbacks, mLoadGroup,
getter_AddRefs(callbacks));
if (!callbacks)
return;
Unused << gHttpHandler->SpeculativeConnect(
- mConnectionInfo, callbacks, mCaps & NS_HTTP_DISALLOW_SPDY);
+ mConnectionInfo, callbacks,
+ mCaps & (NS_HTTP_DISALLOW_SPDY | NS_HTTP_DISABLE_TRR));
}
void
nsHttpChannel::DoNotifyListenerCleanup()
{
// We don't need this info anymore
CleanRedirectCacheChainIfNecessary();
}
@@ -968,19 +973,16 @@ nsHttpChannel::SetupTransaction()
mAltDataLength = 0;
}
mCacheInputStream.CloseAndRelease();
}
}
mUsedNetwork = 1;
- if (mTRR) {
- mCaps |= NS_HTTP_LARGE_KEEPALIVE;
- }
if (!mAllowSpdy) {
mCaps |= NS_HTTP_DISALLOW_SPDY;
}
if (mBeConservative) {
mCaps |= NS_HTTP_BE_CONSERVATIVE;
}
// Use the URI path if not proxying (transparent proxying such as proxy
--- a/netwerk/protocol/http/nsHttpConnectionMgr.cpp
+++ b/netwerk/protocol/http/nsHttpConnectionMgr.cpp
@@ -4061,16 +4061,20 @@ nsHalfOpenSocket::SetupStreams(nsISocket
getter_AddRefs(socketTransport));
}
NS_ENSURE_SUCCESS(rv, rv);
uint32_t tmpFlags = 0;
if (mCaps & NS_HTTP_REFRESH_DNS)
tmpFlags = nsISocketTransport::BYPASS_CACHE;
+ if (mCaps & NS_HTTP_DISABLE_TRR) {
+ tmpFlags = nsISocketTransport::DISABLE_TRR;
+ }
+
if (mCaps & NS_HTTP_LOAD_ANONYMOUS)
tmpFlags |= nsISocketTransport::ANONYMOUS_CONNECT;
if (ci->GetPrivate())
tmpFlags |= nsISocketTransport::NO_PERMANENT_STORAGE;
if ((mCaps & NS_HTTP_BE_CONSERVATIVE) || ci->GetBeConservative()) {
LOG(("Setting Socket to BE_CONSERVATIVE"));