-*- coding: utf-8 -*-
Changes with Apache 2.5.0
+
+ *) mod_cache: Consider Cache-Control: s-maxage in expiration
+ calculations. [Eric Covener]
+
+ *) mod_cache: Allow caching of responses with an Expires header
+ in the past that also has Cache-Control: max-age or s-maxage.
+ PR55156. [Eric Covener]
*) ap_expr: expression support for variable HTTP2=on|off
[Stefan Eissing]
/* if a broken Expires header is present, don't cache it */
reason = apr_pstrcat(p, "Broken expires header: ", exps, NULL);
}
- else if (!dconf->store_expired && exp != APR_DATE_BAD
+ else if (!control.s_maxage && !control.max_age
+ && !dconf->store_expired && exp != APR_DATE_BAD
&& exp < r->request_time) {
- /* if a Expires header is in the past, don't cache it */
+ /* if a Expires header is in the past, don't cache it
+ * Unless CC: s-maxage or max-age is present
+ */
reason = "Expires header already expired; not cacheable";
}
else if (!dconf->store_expired && (control.must_revalidate
"replacing with now");
}
+
+ /* CC has priority over Expires. */
+ if (control.s_maxage || control.max_age) {
+ apr_int64_t x;
+
+ x = control.s_maxage ? control.s_maxage_value : control.max_age_value;
+ x = x * MSEC_ONE_SEC;
+
+ if (x < dconf->minex) {
+ x = dconf->minex;
+ }
+ if (x > dconf->maxex) {
+ x = dconf->maxex;
+ }
+ exp = date + x;
+ }
+
/* if no expiry date then
+ * if Cache-Control: s-maxage
+ * expiry date = date + smaxage
* if Cache-Control: max-age
* expiry date = date + max-age
* else if lastmod
* else
* expire date = date + defaultexpire
*/
- if (exp == APR_DATE_BAD) {
-
- if (control.max_age) {
- apr_int64_t x;
- x = control.max_age_value * MSEC_ONE_SEC;
-
- if (x < dconf->minex) {
- x = dconf->minex;
- }
- if (x > dconf->maxex) {
- x = dconf->maxex;
- }
- exp = date + x;
- }
- else if ((lastmod != APR_DATE_BAD) && (lastmod < date)) {
+ if (exp == APR_DATE_BAD) {
+ if ((lastmod != APR_DATE_BAD) && (lastmod < date)) {
/* if lastmod == date then you get 0*conf->factor which results in
* an expiration time of now. This causes some problems with
* freshness calculations, so we choose the else path...