mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 938803 - Change nsDNSPrefetch and nsHttpChannel::BeginConnect to honor cache bypassing in load flags r=mcmanus
This commit is contained in:
parent
d0b09861a0
commit
fd511cc814
@ -58,21 +58,24 @@ nsDNSPrefetch::Prefetch(uint16_t flags)
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDNSPrefetch::PrefetchLow()
|
||||
nsDNSPrefetch::PrefetchLow(bool refreshDNS)
|
||||
{
|
||||
return Prefetch(nsIDNSService::RESOLVE_PRIORITY_LOW);
|
||||
return Prefetch(nsIDNSService::RESOLVE_PRIORITY_LOW |
|
||||
(refreshDNS ? nsIDNSService::RESOLVE_BYPASS_CACHE : 0));
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDNSPrefetch::PrefetchMedium()
|
||||
nsDNSPrefetch::PrefetchMedium(bool refreshDNS)
|
||||
{
|
||||
return Prefetch(nsIDNSService::RESOLVE_PRIORITY_MEDIUM);
|
||||
return Prefetch(nsIDNSService::RESOLVE_PRIORITY_MEDIUM |
|
||||
(refreshDNS ? nsIDNSService::RESOLVE_BYPASS_CACHE : 0));
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDNSPrefetch::PrefetchHigh()
|
||||
nsDNSPrefetch::PrefetchHigh(bool refreshDNS)
|
||||
{
|
||||
return Prefetch(0);
|
||||
return Prefetch(refreshDNS ?
|
||||
nsIDNSService::RESOLVE_BYPASS_CACHE : 0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -33,9 +33,9 @@ public:
|
||||
static nsresult Shutdown();
|
||||
|
||||
// Call one of the following methods to start the Prefetch.
|
||||
nsresult PrefetchHigh();
|
||||
nsresult PrefetchMedium();
|
||||
nsresult PrefetchLow();
|
||||
nsresult PrefetchHigh(bool refreshDNS = false);
|
||||
nsresult PrefetchMedium(bool refreshDNS = false);
|
||||
nsresult PrefetchLow(bool refreshDNS = false);
|
||||
|
||||
private:
|
||||
nsCString mHostname;
|
||||
|
@ -4514,6 +4514,9 @@ nsHttpChannel::BeginConnect()
|
||||
// if this somehow fails we can go on without it
|
||||
gHttpHandler->AddConnectionHeader(&mRequestHead.Headers(), mCaps);
|
||||
|
||||
if (mLoadFlags & VALIDATE_ALWAYS || BYPASS_LOCAL_CACHE(mLoadFlags))
|
||||
mCaps |= NS_HTTP_REFRESH_DNS;
|
||||
|
||||
if (!mConnectionInfo->UsingHttpProxy()) {
|
||||
// Start a DNS lookup very early in case the real open is queued the DNS can
|
||||
// happen in parallel. Do not do so in the presence of an HTTP proxy as
|
||||
@ -4526,9 +4529,15 @@ nsHttpChannel::BeginConnect()
|
||||
// be correct, and even when it isn't, the timing still represents _a_
|
||||
// valid DNS lookup timing for the site, even if it is not _the_
|
||||
// timing we used.
|
||||
LOG(("nsHttpChannel::BeginConnect [this=%p] prefetching\n", this));
|
||||
LOG(("nsHttpChannel::BeginConnect [this=%p] prefetching%s\n",
|
||||
this, mCaps & NS_HTTP_REFRESH_DNS ? ", refresh requested" : ""));
|
||||
mDNSPrefetch = new nsDNSPrefetch(mURI, mTimingEnabled);
|
||||
mDNSPrefetch->PrefetchHigh();
|
||||
mDNSPrefetch->PrefetchHigh(mCaps & NS_HTTP_REFRESH_DNS);
|
||||
|
||||
if (mCaps & NS_HTTP_REFRESH_DNS) {
|
||||
// Refresh already triggered; stop socket from refreshing too.
|
||||
mCaps &= ~NS_HTTP_REFRESH_DNS;
|
||||
}
|
||||
}
|
||||
|
||||
// Adjust mCaps according to our request headers:
|
||||
@ -4537,10 +4546,6 @@ nsHttpChannel::BeginConnect()
|
||||
if (mRequestHead.HasHeaderValue(nsHttp::Connection, "close"))
|
||||
mCaps &= ~(NS_HTTP_ALLOW_KEEPALIVE | NS_HTTP_ALLOW_PIPELINING);
|
||||
|
||||
if ((mLoadFlags & VALIDATE_ALWAYS) ||
|
||||
(BYPASS_LOCAL_CACHE(mLoadFlags)))
|
||||
mCaps |= NS_HTTP_REFRESH_DNS;
|
||||
|
||||
if (gHttpHandler->CriticalRequestPrioritization()) {
|
||||
if (mLoadAsBlocking)
|
||||
mCaps |= NS_HTTP_LOAD_AS_BLOCKING;
|
||||
|
Loading…
Reference in New Issue
Block a user