зеркало из https://github.com/mozilla/pjs.git
Fixed bug 75709 "expires header not honored, gets cached copy"
r=gordon, sr=dougt, a=asa
This commit is contained in:
Родитель
a8e5c0b7bc
Коммит
ba87abb6dd
|
@ -746,6 +746,20 @@ nsHttpChannel::CheckCache()
|
|||
goto end;
|
||||
}
|
||||
|
||||
// Compare the Expires header to the Date header. If the server sent an
|
||||
// Expires header with a timestamp in the past, then we must validate this
|
||||
// cached response before reusing.
|
||||
{
|
||||
PRUint32 expiresVal, dateVal;
|
||||
if (NS_SUCCEEDED(mCachedResponseHead->GetExpiresValue(&expiresVal)) &&
|
||||
NS_SUCCEEDED(mCachedResponseHead->GetDateValue(&dateVal)) &&
|
||||
expiresVal < dateVal) {
|
||||
LOG(("Validating since Expires < Date\n"));
|
||||
doValidation = PR_TRUE;
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
// Check the Vary header. Per comments on bug 37609, most of the request
|
||||
// headers that we generate do not vary with the exception of Accept-Charset
|
||||
// and Accept-Language, so we force validation only if these headers or "*"
|
||||
|
|
|
@ -81,10 +81,6 @@ public:
|
|||
// reset the response head to it's initial state
|
||||
void Reset();
|
||||
|
||||
private:
|
||||
void ParseVersion(const char *);
|
||||
nsresult ParseContentType(char *);
|
||||
|
||||
// these return failure if the header does not exist.
|
||||
nsresult ParseDateHeader(nsHttpAtom header, PRUint32 *result);
|
||||
nsresult GetAgeValue(PRUint32 *result);
|
||||
|
@ -93,6 +89,10 @@ private:
|
|||
nsresult GetExpiresValue(PRUint32 *result) { return ParseDateHeader(nsHttp::Expires, result); }
|
||||
nsresult GetLastModifiedValue(PRUint32 *result) { return ParseDateHeader(nsHttp::Last_Modified, result); }
|
||||
|
||||
private:
|
||||
void ParseVersion(const char *);
|
||||
nsresult ParseContentType(char *);
|
||||
|
||||
private:
|
||||
nsHttpHeaderArray mHeaders;
|
||||
nsHttpVersion mVersion;
|
||||
|
|
Загрузка…
Ссылка в новой задаче