httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r539430 - in /httpd/httpd/branches/2.2.x: CHANGES STATUS modules/cache/mod_cache.c
Date Fri, 18 May 2007 12:41:15 GMT
Author: jim
Date: Fri May 18 05:41:14 2007
New Revision: 539430

URL: http://svn.apache.org/viewvc?view=rev&rev=539430
Log:
Backport:

   * mod_cache: Let Cache-Control max-age set the expiration date. 
        Trunk version of patch:
         http://svn.apache.org/viewvc?view=rev&revision=539063
        2.2.x version of patch:
         http://people.apache.org/~jerenkrantz/max-age-expire-2.2.x.patch
         (No ->minex in 2.2.x)
        +1: jerenkrantz, fielding, striker


Modified:
    httpd/httpd/branches/2.2.x/CHANGES
    httpd/httpd/branches/2.2.x/STATUS
    httpd/httpd/branches/2.2.x/modules/cache/mod_cache.c

Modified: httpd/httpd/branches/2.2.x/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/CHANGES?view=diff&rev=539430&r1=539429&r2=539430
==============================================================================
--- httpd/httpd/branches/2.2.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.2.x/CHANGES [utf-8] Fri May 18 05:41:14 2007
@@ -1,6 +1,9 @@
                                                         -*- coding: utf-8 -*-
 Changes with Apache 2.2.5
 
+  *) mod_cache: Let Cache-Control max-age set the expiration of the cached
+     representation if Expires is not set.  [Justin Erenkrantz]
+
   *) mod_cache: Allow caching of requests with query arguments when
      Cache-Control max-age is explicitly specified.  [Justin Erenkrantz]
 

Modified: httpd/httpd/branches/2.2.x/STATUS
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/STATUS?view=diff&rev=539430&r1=539429&r2=539430
==============================================================================
--- httpd/httpd/branches/2.2.x/STATUS (original)
+++ httpd/httpd/branches/2.2.x/STATUS Fri May 18 05:41:14 2007
@@ -86,14 +86,6 @@
       +1: jfclere, rpluem, wrowe
       jerenkrantz says: Does not apply cleanly to 2.2.x.
 
-   * mod_cache: Let Cache-Control max-age set the expiration date.
-     Trunk version of patch:
-       http://svn.apache.org/viewvc?view=rev&revision=539063
-     2.2.x version of patch:
-       http://people.apache.org/~jerenkrantz/max-age-expire-2.2.x.patch
-       (No ->minex in 2.2.x)
-     +1: jerenkrantz, fielding, striker
-
 PATCHES PROPOSED TO BACKPORT FROM TRUNK:
 
     * ApacheMonitor: Fix Windows Vista detection.

Modified: httpd/httpd/branches/2.2.x/modules/cache/mod_cache.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/modules/cache/mod_cache.c?view=diff&rev=539430&r1=539429&r2=539430
==============================================================================
--- httpd/httpd/branches/2.2.x/modules/cache/mod_cache.c (original)
+++ httpd/httpd/branches/2.2.x/modules/cache/mod_cache.c Fri May 18 05:41:14 2007
@@ -701,19 +701,39 @@
     }
 
     /* if no expiry date then
-     *   if lastmod
+     *   if Cache-Control: max-age present
+     *      expiry date = date + max-age
+     *   else if lastmod
      *      expiry date = date + min((date - lastmod) * factor, maxexpire)
      *   else
      *      expire date = date + defaultexpire
      */
     if (exp == APR_DATE_BAD) {
         char expire_hdr[APR_RFC822_DATE_LEN];
+        char *max_age_val;
 
-        /* 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...
-         */
-        if ((lastmod != APR_DATE_BAD) && (lastmod < date)) {
+        if (ap_cache_liststr(r->pool, cc_out, "max-age", &max_age_val) &&
+            max_age_val != NULL) {
+            apr_int64_t x;
+
+            errno = 0;
+            x = apr_atoi64(max_age_val);
+            if (errno) {
+                x = conf->defex;
+            }
+            else {
+                x = x * MSEC_ONE_SEC;
+            }
+            if (x > conf->maxex) {
+                x = conf->maxex;
+            }
+            exp = date + x;
+        }
+        else 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...
+             */
             apr_time_t x = (apr_time_t) ((date - lastmod) * conf->factor);
 
             if (x > conf->maxex) {



Mime
View raw message