зеркало из https://github.com/mozilla/gecko-dev.git
bug 53122 OnFileAvailable() not being called due to release of
mCacheEntry by nsHTTPChannel before calling stop request. Delaying release until after onStopRequest is called. bug 51043 Caching cgi when we are not supposed to. Now we refetch a page if there isn't Modified-Since header being sent. That isolates cgis pretty well and keeps normal pages working as is. bug 53272 Cache corruption triggers when we hit DNS errors. This is due to the entry being in memory and never being flushed to disk. Calling CacheAbort() on the error condition from ResponseCompleted() takes care of that. r=neeti, gagan
This commit is contained in:
Родитель
5e7b70af9e
Коммит
8d3608aa5e
|
@ -1137,11 +1137,14 @@ nsHTTPChannel::CheckCache()
|
|||
}
|
||||
}
|
||||
|
||||
if (doIfModifiedSince) {
|
||||
// Add If-Modified-Since header
|
||||
// If there is no if-modified header, we will refetch This will cause refetch of cgi's
|
||||
// on link click and url typein
|
||||
nsXPIDLCString lastModified;
|
||||
mCachedResponse->GetHeader(nsHTTPAtoms::Last_Modified,
|
||||
getter_Copies(lastModified));
|
||||
|
||||
if (doIfModifiedSince)
|
||||
{
|
||||
if (lastModified)
|
||||
SetRequestHeader(nsHTTPAtoms::If_Modified_Since, lastModified);
|
||||
|
||||
|
@ -1152,8 +1155,13 @@ nsHTTPChannel::CheckCache()
|
|||
SetRequestHeader(nsHTTPAtoms::If_None_Match, etag);
|
||||
}
|
||||
|
||||
if (!lastModified)
|
||||
// This is most probably a cgi. Refetch unconditionally.
|
||||
mCachedContentIsValid = PR_FALSE;
|
||||
else
|
||||
mCachedContentIsValid = !doIfModifiedSince;
|
||||
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1820,6 +1828,14 @@ nsresult nsHTTPChannel::ResponseCompleted(nsIStreamListener *aListener,
|
|||
mCacheTransport = nsnull;
|
||||
|
||||
if (mCacheEntry)
|
||||
{
|
||||
if (NS_FAILED(aStatus))
|
||||
{
|
||||
// The url failed. This could be a DNS failure or server error
|
||||
// We have covered the server errors elsewhere. On DNS error, do CacheAbort().
|
||||
CacheAbort(aStatus);
|
||||
}
|
||||
else
|
||||
{
|
||||
// The no-store directive within the 'Cache-Control:' header indicates
|
||||
// that we should not store the response in the cache
|
||||
|
@ -1855,15 +1871,10 @@ nsresult nsHTTPChannel::ResponseCompleted(nsIStreamListener *aListener,
|
|||
}
|
||||
|
||||
if (dontCache)
|
||||
{
|
||||
mCacheEntry->SetStoredContentLength(0);
|
||||
}
|
||||
}
|
||||
|
||||
// Release the cache entry as soon as we are done. This helps as it can
|
||||
// flush any cache records and do maintenance.
|
||||
mCacheEntry = nsnull;
|
||||
|
||||
//
|
||||
// Call the consumer OnStopRequest(...) to end the request...
|
||||
//----------------------------------------------------------------
|
||||
|
@ -1879,6 +1890,12 @@ nsresult nsHTTPChannel::ResponseCompleted(nsIStreamListener *aListener,
|
|||
}
|
||||
}
|
||||
|
||||
// Release the cache entry as soon as we are done. This helps as it can
|
||||
// flush any cache records and do maintenance. But do this only after
|
||||
// stopRequest has been fired as the stopListeners could want to use
|
||||
// the cache entry like the plugin listener.
|
||||
mCacheEntry = nsnull;
|
||||
|
||||
//
|
||||
// After the consumer has been notified, remove the channel from its
|
||||
// load group... This will trigger an OnStopRequest from the load group.
|
||||
|
|
Загрузка…
Ссылка в новой задаче