case CC_STALE_IF_ERROR:
if (!p || !httpHeaderParseInt(p, &cc->stale_if_error)) {
debugs(65, 2, "cc: invalid stale-if-error specs near '" << item << "'");
- cc->stale_if_error = -1;
- EBIT_CLR(cc->mask, type);
+ cc->setStaleIfError(STALE_IF_ERROR_UNSET);
}
break;
}
}
-int32_t HttpHdrCc::getMaxAge() const
+int32_t
+HttpHdrCc::getMaxAge() const
{
return max_age;
}
-void HttpHdrCc::setSMaxAge(int32_t s_maxage)
+void
+HttpHdrCc::setSMaxAge(int32_t s_maxage)
{
if (s_maxage >= 0) {
EBIT_SET(mask, CC_S_MAXAGE);
}
}
-int32_t HttpHdrCc::getSMaxAge() const
+int32_t
+HttpHdrCc::getSMaxAge() const
{
return s_maxage;
}
-void HttpHdrCc::setMaxStale(int32_t max_stale)
+void
+HttpHdrCc::setMaxStale(int32_t max_stale)
{
if (max_stale>=0 || max_stale==MAX_STALE_ALWAYS) {
EBIT_SET(mask,CC_MAX_STALE);
this->max_stale=MAX_STALE_UNSET;
}
}
-int32_t HttpHdrCc::getMaxStale() const
+int32_t
+HttpHdrCc::getMaxStale() const
{
return max_stale;
}
+
+void
+HttpHdrCc::setStaleIfError(int32_t stale_if_error)
+{
+ if (stale_if_error >= 0) {
+ EBIT_SET(mask, CC_STALE_IF_ERROR);
+ this->stale_if_error=stale_if_error;
+ } else {
+ EBIT_CLR(mask, CC_STALE_IF_ERROR);
+ this->stale_if_error=STALE_IF_ERROR_UNSET;
+ }
+}
+
+int32_t
+HttpHdrCc::getStaleIfError() const
+{
+ return stale_if_error;
+}
static const int32_t S_MAXAGE_UNSET=-1; //s-maxage is unset
static const int32_t MAX_STALE_UNSET=-1; //max-stale is unset
static const int32_t MAX_STALE_ALWAYS=-2; //max-stale is set to no value
+ static const int32_t STALE_IF_ERROR_UNSET=-1; //stale_if_error is unset
explicit HttpHdrCc() :
mask(0), max_age(MAX_AGE_UNSET), s_maxage(S_MAXAGE_UNSET),
- max_stale(MAX_STALE_UNSET), stale_if_error(0),
+ max_stale(MAX_STALE_UNSET), stale_if_error(STALE_IF_ERROR_UNSET),
min_fresh(-1) {}
void clear();
void setMaxStale(int32_t max_stale);
int32_t getMaxStale() const;
+ void setStaleIfError(int32_t stale_if_error);
+ int32_t getStaleIfError() const;
+
MEMPROXY_CLASS(HttpHdrCc);
int32_t mask;
int32_t max_age;
int32_t s_maxage;
int32_t max_stale;
-public:
int32_t stale_if_error;
+public:
int32_t min_fresh;
String other;
};
// 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 &&
- EBIT_TEST(entry->mem_obj->getReply()->cache_control->mask, CC_STALE_IF_ERROR) &&
- entry->mem_obj->getReply()->cache_control->stale_if_error < staleness) {
+ entry->mem_obj->getReply()->cache_control->getStaleIfError() != HttpHdrCc::STALE_IF_ERROR_UNSET &&
+ entry->mem_obj->getReply()->cache_control->getStaleIfError() < staleness) {
debugs(22, 3, "refreshCheck: stale-if-error period expired.");
request->flags.fail_on_validation_err = 1;