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

bug 127348 r=gagan sr=darin a=asa
This commit is contained in:
badami%netscape.com 2002-03-20 04:33:51 +00:00
Родитель e1e0b68be2
Коммит 7136a70c0c
1 изменённых файлов: 14 добавлений и 2 удалений

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

@ -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);