switch (type) {
case CC_MAX_AGE:
-
- if (!p || !httpHeaderParseInt(p, &cc->max_age)) {
+ int32_t ma;
+ if (!p || !httpHeaderParseInt(p, &ma)) {
debugs(65, 2, "cc: invalid max-age specs near '" << item << "'");
- cc->max_age = -1;
- EBIT_CLR(cc->mask, type);
+ cc->setMaxAge(-1);
+ } else {
+ cc->setMaxAge(ma);
}
break;
/* handle options with values */
if (flag == CC_MAX_AGE)
- packerPrintf(p, "=%d", (int) cc->max_age);
+ packerPrintf(p, "=%d", (int) cc->getMaxAge());
if (flag == CC_S_MAXAGE)
packerPrintf(p, "=%d", (int) cc->s_maxage);
void
HttpHdrCc::setMaxAge(int max_age_)
{
- max_age = max_age_;
- if (max_age_ >= 0)
+ if (max_age_ >= 0) {
EBIT_SET(mask, CC_MAX_AGE);
- else
+ max_age = max_age_;
+ } else {
EBIT_CLR(mask, CC_MAX_AGE);
+ max_age=-1;
+ }
}
void
storeAppendPrintf(sentry, "%2d\t %-20s\t %5d\t %6.2f\n",
id, name, count, xdiv(count, dump_stat->ccParsedCount));
}
+
+int32_t HttpHdrCc::getMaxAge() const
+{
+ return max_age;
+}
+
+
max_stale(-1), stale_if_error(0),
min_fresh(-1) {}
- /// reset to the after-default-construction state.
void clear();
-
- /**parse the supplied string filling in HttpHdrCc's fields.
- *
- * \note: internal structures are not cleaned-up beforehand.
- * caller must explicitly clear() beforehand if he wants that
- */
- bool parse(const String &s);
-
- /** set the max_age value
- *
- * \param max_age the new max age. Values <0 clear it.
- */
+ bool parse(const String & s);
void setMaxAge(int32_t max_age);
-
+ int32_t getMaxAge() const;
MEMPROXY_CLASS(HttpHdrCc);
- /// bit-mask for the various Cc directives, keyed on http_hdr_cc_type
int32_t mask;
+private:
int32_t max_age;
+public:
int32_t s_maxage;
int32_t max_stale;
int32_t stale_if_error;
int32_t min_fresh;
- /// comma-separated string accumulating unknown Cache-control directives.
String other;
};
if (cache_control->s_maxage >= 0)
return date + cache_control->s_maxage;
- if (cache_control->max_age >= 0)
- return date + cache_control->max_age;
+ if (cache_control->getMaxAge() >= 0)
+ return date + cache_control->getMaxAge();
} else {
/*
* Conservatively handle the case when we have a max-age
if (cache_control->s_maxage >= 0)
return squid_curtime;
- if (cache_control->max_age >= 0)
+ if (cache_control->getMaxAge() >= 0)
return squid_curtime;
}
}
#endif
if (NULL != cc) {
- if (cc->max_age > -1) {
+ if (cc->getMaxAge() >= 0) {
#if USE_HTTP_VIOLATIONS
- if (R->flags.ignore_reload && cc->max_age == 0) {
+ if (R->flags.ignore_reload && cc->getMaxAge() == 0) {
debugs(22, 3, "refreshCheck: MAYBE: client-max-age = 0 and ignore-reload");
} else
#endif
{
- if (cc->max_age == 0) {
+ if (cc->getMaxAge() == 0) {
debugs(22, 3, "refreshCheck: YES: client-max-age = 0");
return STALE_EXCEEDS_REQUEST_MAX_AGE_VALUE;
}
- if (age > cc->max_age) {
+ if (age > cc->getMaxAge()) {
debugs(22, 3, "refreshCheck: YES: age > client-max-age");
return STALE_EXCEEDS_REQUEST_MAX_AGE_VALUE;
}