Redirection limit for this URL exceeded; Doom cache entry if redirecting back to self

bug 127348 r=gagan sr=darin a=asa


git-svn-id: svn://10.0.0.236/trunk@116947 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
badami%netscape.com 2002-03-20 04:33:51 +00:00
parent 0d828695c6
commit c8d7edf2a2

View File

@ -498,10 +498,14 @@ nsHttpChannel::ProcessResponse()
case 302:
case 307:
// these redirects can be cached (don't store the response body)
if (mCacheEntry)
CloseCacheEntry(InitCacheEntry());
if (mCacheEntry) {
rv = InitCacheEntry();
if (NS_FAILED(rv))
CloseCacheEntry(rv);
}
rv = ProcessRedirection(httpStatus);
CloseCacheEntry(rv);
if (NS_FAILED(rv)) {
LOG(("ProcessRedirection failed [rv=%x]\n", rv));
rv = ProcessNormal();
@ -1240,6 +1244,14 @@ nsHttpChannel::ProcessRedirection(PRUint32 redirectType)
getter_AddRefs(newURI));
if (NS_FAILED(rv)) return rv;
// Kill the current cache entry if we are redirecting
// back to ourself.
PRBool redirectingBackToSameURI = PR_FALSE;
if (mCacheEntry && (mCacheAccess & nsICache::ACCESS_WRITE) &&
NS_SUCCEEDED(mURI->Equals(newURI, &redirectingBackToSameURI)) &&
redirectingBackToSameURI)
mCacheEntry->Doom();
// move the reference of the old location to the new one if the new
// one has none.
nsCOMPtr<nsIURL> newURL = do_QueryInterface(newURI, &rv);