{"max-age", (http_hdr_type)CC_MAX_AGE},
{"s-maxage", (http_hdr_type)CC_S_MAXAGE},
{"max-stale", (http_hdr_type)CC_MAX_STALE},
+ {"min-fresh", (http_hdr_type)CC_MIN_FRESH},
{"Other,", (http_hdr_type)CC_OTHER} /* ',' will protect from matches */
};
httpHdrCcCreate(void)
{
HttpHdrCc *cc = (HttpHdrCc *)memAllocate(MEM_HTTP_HDR_CC);
- cc->max_age = cc->s_maxage = cc->max_stale = -1;
+ cc->max_age = cc->s_maxage = cc->max_stale = cc->min_fresh = -1;
return cc;
}
break;
+ case CC_MIN_FRESH:
+
+ if (!p || !httpHeaderParseInt(p, &cc->min_fresh)) {
+ debugs(65, 2, "cc: invalid min-fresh specs near '" << item << "'");
+ cc->min_fresh = -1;
+ EBIT_CLR(cc->mask, type);
+ }
+
+ break;
+
case CC_OTHER:
if (cc->other.size())
dup->max_age = cc->max_age;
dup->s_maxage = cc->s_maxage;
dup->max_stale = cc->max_stale;
+ dup->min_fresh = cc->min_fresh;
return dup;
}
if (flag == CC_MAX_STALE && cc->max_stale >= 0)
packerPrintf(p, "=%d", (int) cc->max_stale);
+ if (flag == CC_MIN_FRESH)
+ packerPrintf(p, "=%d", (int) cc->min_fresh);
+
pcount++;
}
}
if (NULL == R)
R = &DefaultRefresh;
- memset(&sf, '\0', sizeof(sf));
-
- staleness = refreshStaleness(entry, check_time, age, R, &sf);
-
- debugs(22, 3, "Staleness = " << staleness);
-
debugs(22, 3, "refreshCheck: Matched '" << R->pattern << " " <<
(int) R->min << " " << (int) (100.0 * R->pct) << "%% " <<
(int) R->max << "'");
-
- debugs(22, 3, "refreshCheck: age = " << age);
+ debugs(22, 3, "\tage:\t" << age);
debugs(22, 3, "\tcheck_time:\t" << mkrfc1123(check_time));
debugs(22, 3, "\tentry->timestamp:\t" << mkrfc1123(entry->timestamp));
+ if (request && !request->flags.ignore_cc) {
+ const HttpHdrCc *const cc = request->cache_control;
+ if (cc && cc->min_fresh > 0) {
+ debugs(22, 3, "\tage + min-fresh:\t" << age << " + " <<
+ cc->min_fresh << " = " << age + cc->min_fresh);
+ debugs(22, 3, "\tcheck_time + min-fresh:\t" << check_time << " + "
+ << cc->min_fresh << " = " <<
+ mkrfc1123(check_time + cc->min_fresh));
+ age += cc->min_fresh;
+ check_time += cc->min_fresh;
+ }
+ }
+
+ memset(&sf, '\0', sizeof(sf));
+
+ staleness = refreshStaleness(entry, check_time, age, R, &sf);
+
+ debugs(22, 3, "Staleness = " << staleness);
+
if (EBIT_TEST(entry->flags, ENTRY_REVALIDATE) && staleness > -1
#if HTTP_VIOLATIONS
&& !R->flags.ignore_must_revalidate