{"min-fresh", HttpHdrCcType::CC_MIN_FRESH},
{"only-if-cached", HttpHdrCcType::CC_ONLY_IF_CACHED},
{"stale-if-error", HttpHdrCcType::CC_STALE_IF_ERROR},
+ {"immutable", HttpHdrCcType::CC_IMMUTABLE},
{"Other,", HttpHdrCcType::CC_OTHER}, /* ',' will protect from matches */
{nullptr, HttpHdrCcType::CC_ENUM_END}
};
case HttpHdrCcType::CC_ONLY_IF_CACHED:
onlyIfCached(true);
break;
+ case HttpHdrCcType::CC_IMMUTABLE:
+ Immutable(true);
+ break;
case HttpHdrCcType::CC_OTHER:
if (other.size())
case HttpHdrCcType::CC_STALE_IF_ERROR:
p->appendf("=%d", staleIfError());
break;
+ case HttpHdrCcType::CC_IMMUTABLE:
+ break;
case HttpHdrCcType::CC_OTHER:
case HttpHdrCcType::CC_ENUM_END:
// done below after the loop
CC_MIN_FRESH,
CC_ONLY_IF_CACHED,
CC_STALE_IF_ERROR,
+ CC_IMMUTABLE, /* draft-mcmanus-immutable-00 */
CC_OTHER,
CC_ENUM_END /* also used to mean "invalid" */
};
void staleIfError(int32_t v) {setValue(stale_if_error,v,HttpHdrCcType::CC_STALE_IF_ERROR); }
void clearStaleIfError() {setValue(stale_if_error,STALE_IF_ERROR_UNKNOWN,HttpHdrCcType::CC_STALE_IF_ERROR,false);}
+ //manipulation for Cache-Control: immutable header
+ bool Immutable() const {return isSet(HttpHdrCcType::CC_IMMUTABLE);}
+ void Immutable(bool v) {setMask(HttpHdrCcType::CC_IMMUTABLE,v);}
+ void clearImmutable() {setMask(HttpHdrCcType::CC_IMMUTABLE,false);}
+
/// check whether the attribute value supplied by id is set
_SQUID_INLINE_ bool isSet(HttpHdrCcType id) const;
debugs(22, 3, "Staleness = " << staleness);
+ const auto *reply = (entry->mem_obj && entry->mem_obj->getReply() ? entry->mem_obj->getReply() : nullptr);
+
// stale-if-error requires any failure be passed thru when its period is over.
- if (request && entry->mem_obj && entry->mem_obj->getReply() && entry->mem_obj->getReply()->cache_control &&
- entry->mem_obj->getReply()->cache_control->hasStaleIfError() &&
- entry->mem_obj->getReply()->cache_control->staleIfError() < staleness) {
+ if (request && reply && reply->cache_control &&
+ reply->cache_control->hasStaleIfError() &&
+ reply->cache_control->staleIfError() < staleness) {
debugs(22, 3, "stale-if-error period expired. Will produce error if validation fails.");
request->flags.failOnValidationError = true;
// max-age directive
if (cc->hasMaxAge()) {
+
+ // draft-mcmanus-immutable-00: reply contains CC:immutable then ignore client CC:max-age=N
+ if (reply && reply->cache_control && reply->cache_control->Immutable()) {
+ debugs(22, 3, "MAYBE: Ignoring client CC:max-age=" << cc->maxAge() << " request - 'Cache-Control: immutable'");
+
#if USE_HTTP_VIOLATIONS
- // Ignore client "Cache-Control: max-age=0" header
- if (R->flags.ignore_reload && cc->maxAge() == 0) {
+ // Ignore of client "Cache-Control: max-age=0" header
+ } else if (R->flags.ignore_reload && cc->maxAge() == 0) {
debugs(22, 3, "MAYBE: Ignoring client reload request - trying to serve from cache (ignore-reload option)");
- } else
#endif
- {
- // Honour client "Cache-Control: max-age=x" header
- if (age > cc->maxAge() || cc->maxAge() == 0) {
- debugs(22, 3, "YES: Revalidating object - client 'Cache-Control: max-age=" << cc->maxAge() << "'");
- return STALE_EXCEEDS_REQUEST_MAX_AGE_VALUE;
- }
+
+ // Honour client "Cache-Control: max-age=x" header
+ } else if (age > cc->maxAge() || cc->maxAge() == 0) {
+ debugs(22, 3, "YES: Revalidating object - client 'Cache-Control: max-age=" << cc->maxAge() << "'");
+ return STALE_EXCEEDS_REQUEST_MAX_AGE_VALUE;
}
}