Bug 1117763 - Remove range request headers on cache entry open failure. r=michal

This commit is contained in:
Honza Bambas 2015-02-13 07:54:00 -05:00
Родитель cc4a1f03e4
Коммит 648b93198b
2 изменённых файлов: 18 добавлений и 4 удалений

Просмотреть файл

@ -2216,8 +2216,7 @@ nsHttpChannel::MaybeSetupByteRangeRequest(int64_t partialLen, int64_t contentLen
nsresult rv = SetupByteRangeRequest(partialLen);
if (NS_FAILED(rv)) {
// Make the request unconditional again.
mRequestHead.ClearHeader(nsHttp::Range);
mRequestHead.ClearHeader(nsHttp::If_Range);
UntieByteRangeRequest();
}
return rv;
@ -2251,6 +2250,13 @@ nsHttpChannel::SetupByteRangeRequest(int64_t partialLen)
return NS_OK;
}
void
nsHttpChannel::UntieByteRangeRequest()
{
mRequestHead.ClearHeader(nsHttp::Range);
mRequestHead.ClearHeader(nsHttp::If_Range);
}
nsresult
nsHttpChannel::ProcessPartialContent()
{
@ -2965,9 +2971,16 @@ nsHttpChannel::OnCacheEntryCheck(nsICacheEntry* entry, nsIApplicationCache* appC
mCachedContentIsPartial = NS_SUCCEEDED(rv) && mIsPartialRequest;
if (mCachedContentIsPartial) {
rv = OpenCacheInputStream(entry, false, !!appCache);
*aResult = ENTRY_NEEDS_REVALIDATION;
if (NS_FAILED(rv)) {
UntieByteRangeRequest();
return rv;
} else if (size == 0 && mCacheOnlyMetadata) {
}
*aResult = ENTRY_NEEDS_REVALIDATION;
return NS_OK;
}
if (size == 0 && mCacheOnlyMetadata) {
// Don't break cache entry load when the entry's data size
// is 0 and mCacheOnlyMetadata flag is set. In that case we
// want to proceed since the LOAD_ONLY_IF_MODIFIED flag is

Просмотреть файл

@ -367,6 +367,7 @@ private:
nsresult MaybeSetupByteRangeRequest(int64_t partialLen, int64_t contentLength,
bool ignoreMissingPartialLen = false);
nsresult SetupByteRangeRequest(int64_t partialLen);
void UntieByteRangeRequest();
nsresult OpenCacheInputStream(nsICacheEntry* cacheEntry, bool startBuffering,
bool checkingAppCacheEntry);