зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1092857 - Drop conditional request headers when there is no cache entry available. r=michal
This commit is contained in:
Родитель
b25a2bb677
Коммит
d39b19327e
|
@ -2854,6 +2854,15 @@ nsHttpChannel::CheckPartial(nsICacheEntry* aEntry, int64_t *aSize, int64_t *aCon
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsHttpChannel::UntieValidationRequest()
|
||||
{
|
||||
// Make the request unconditional again.
|
||||
mRequestHead.ClearHeader(nsHttp::If_Modified_Since);
|
||||
mRequestHead.ClearHeader(nsHttp::If_None_Match);
|
||||
mRequestHead.ClearHeader(nsHttp::ETag);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHttpChannel::OnCacheEntryCheck(nsICacheEntry* entry, nsIApplicationCache* appCache,
|
||||
uint32_t* aResult)
|
||||
|
@ -3205,10 +3214,7 @@ nsHttpChannel::OnCacheEntryCheck(nsICacheEntry* entry, nsIApplicationCache* appC
|
|||
// If we can't get the entity then we have to act as though we
|
||||
// don't have the cache entry.
|
||||
if (mDidReval) {
|
||||
// Make the request unconditional again.
|
||||
mRequestHead.ClearHeader(nsHttp::If_Modified_Since);
|
||||
mRequestHead.ClearHeader(nsHttp::If_None_Match);
|
||||
mRequestHead.ClearHeader(nsHttp::ETag);
|
||||
UntieValidationRequest();
|
||||
mDidReval = false;
|
||||
}
|
||||
mCachedContentIsValid = false;
|
||||
|
@ -3299,12 +3305,14 @@ nsHttpChannel::OnCacheEntryAvailableInternal(nsICacheEntry *entry,
|
|||
return NS_ERROR_DOCUMENT_NOT_CACHED;
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
// We may be waiting for more callbacks...
|
||||
if (AwaitingCacheCallbacks())
|
||||
return NS_OK;
|
||||
if (AwaitingCacheCallbacks()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return ContinueConnect();
|
||||
}
|
||||
|
@ -3321,6 +3329,14 @@ nsHttpChannel::OnNormalCacheEntryAvailable(nsICacheEntry *aEntry,
|
|||
// between OnCacheEntryCheck and OnCacheEntryAvailable.
|
||||
mCachedContentIsValid = false;
|
||||
|
||||
// From the same reason remove any conditional headers added
|
||||
// in OnCacheEntryCheck.
|
||||
if (mDidReval) {
|
||||
LOG((" Removing conditional request headers"));
|
||||
UntieValidationRequest();
|
||||
mDidReval = false;
|
||||
}
|
||||
|
||||
if (mLoadFlags & LOAD_ONLY_FROM_CACHE) {
|
||||
// if this channel is only allowed to pull from the cache, then
|
||||
// we must fail if we were unable to open a cache entry for read.
|
||||
|
|
|
@ -368,6 +368,7 @@ private:
|
|||
bool ignoreMissingPartialLen = false);
|
||||
nsresult SetupByteRangeRequest(int64_t partialLen);
|
||||
void UntieByteRangeRequest();
|
||||
void UntieValidationRequest();
|
||||
nsresult OpenCacheInputStream(nsICacheEntry* cacheEntry, bool startBuffering,
|
||||
bool checkingAppCacheEntry);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче