Bug 1449259: Don't do proxy lookups for loads that are only going to come from the cache. r?mayhemer
MozReview-Commit-ID: GI9t8HWesZY
--- a/netwerk/protocol/http/nsHttpChannel.cpp
+++ b/netwerk/protocol/http/nsHttpChannel.cpp
@@ -6063,18 +6063,20 @@ nsHttpChannel::AsyncOpen(nsIStreamListen
mAsyncOpenTime = TimeStamp::Now();
// Remember we have Authorization header set here. We need to check on it
// just once and early, AsyncOpen is the best place.
mCustomAuthHeader = mRequestHead.HasHeader(nsHttp::Authorization);
// The common case for HTTP channels is to begin proxy resolution and return
// at this point. The only time we know mProxyInfo already is if we're
- // proxying a non-http protocol like ftp.
- if (!mProxyInfo && NS_SUCCEEDED(ResolveProxy())) {
+ // proxying a non-http protocol like ftp. We don't need to discover proxy
+ // settings if we are never going to make a network connection.
+ if (!mProxyInfo && !(mLoadFlags & (LOAD_ONLY_FROM_CACHE | LOAD_NO_NETWORK_IO)) &&
+ NS_SUCCEEDED(ResolveProxy())) {
return NS_OK;
}
rv = BeginConnect();
if (NS_FAILED(rv)) {
CloseCacheEntry(false);
Unused << AsyncAbort(rv);
}