- bug 41950 Getting redirects to work. Adding in LOAD_REPLACE to channel

attributes.
- checking return value from GetCacheContentLegth()
r=mscott,neeti


git-svn-id: svn://10.0.0.236/trunk@77447 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
dp%netscape.com
2000-08-29 03:16:16 +00:00
parent c4f5139c2f
commit 2fd7952b40

View File

@@ -1011,8 +1011,10 @@ nsHTTPChannel::CheckCache()
if (updateInProgress)
return NS_OK;
PRUint32 contentLength;
mCacheEntry->GetStoredContentLength(&contentLength);
PRUint32 contentLength = 0;
if (NS_FAILED(mCacheEntry->GetStoredContentLength(&contentLength)))
// not found in cache.
return NS_OK;
PRBool partialFlag;
mCacheEntry->GetPartialFlag(&partialFlag);
@@ -1055,6 +1057,7 @@ nsHTTPChannel::CheckCache()
if (!LL_IS_ZERO(expirationTime)) {
PRTime now = PR_Now();
if( LL_UCMP( now, >, expirationTime )) {
// -dp- This shouldn't happen.
mCacheEntry->SetExpirationTime(LL_ZERO);
mustRevalidate = PR_TRUE;
}
@@ -1113,7 +1116,7 @@ nsHTTPChannel::CheckCache()
if (LL_UCMP(sessionStartTime, > ,lastAccessTime))
firstAccessThisSession = PR_TRUE;
else
firstAccessThisSession = LL_UCMP(lastUpdateTime, >= ,lastAccessTime);
firstAccessThisSession = LL_UCMP(lastUpdateTime, >= ,lastAccessTime); //-dp- this should be > as == means that this is the second access for this session.
// Check to see if we can use the cache data without revalidating
// it with the server.
@@ -1688,8 +1691,12 @@ nsresult nsHTTPChannel::Redirect(const char *aNewLocation,
if (NS_FAILED(rv)) return rv;
}
// Add in LOAD_REPLACE to loadattributes indicate that this is a redirect
nsLoadFlags loadFlags = mLoadAttributes;
loadFlags |= nsIChannel::LOAD_REPLACE;
rv = NS_OpenURI(getter_AddRefs(channel), newURI, serv, mLoadGroup,
mCallbacks, mLoadAttributes,
mCallbacks, loadFlags,
mBufferSegmentSize, mBufferMaxSize);
if (NS_FAILED(rv)) return rv;
rv = channel->SetOriginalURI(mOriginalURI);