You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by mi...@apache.org on 2011/02/11 21:12:39 UTC

svn commit: r1069942 - in /httpd/httpd/trunk: CHANGES modules/cache/cache_util.c

Author: minfrin
Date: Fri Feb 11 20:12:39 2011
New Revision: 1069942

URL: http://svn.apache.org/viewvc?rev=1069942&view=rev
Log:
mod_cache: Respect s-maxage as described by RFC2616 14.9.3, which must
take precedence if present. PR 35247.

Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/modules/cache/cache_util.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1069942&r1=1069941&r2=1069942&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Fri Feb 11 20:12:39 2011
@@ -2,9 +2,8 @@
 
 Changes with Apache 2.3.11
 
-  *) mod_ssl: Fix a possible startup failure if multiple SSL vhosts
-     are configured with the same ServerName and private key file.
-     [Masahiro Matsuya <mmatsuya redhat.com>, Joe Orton]
+  *) mod_cache: Respect s-maxage as described by RFC2616 14.9.3, which must
+     take precedence if present. PR 35247. [Graham Leggett]
 
   *) mod_socache_dc: Make module compile by fixing some typos.
      PR 50735 [Mark Montague <mark catseye.org>]

Modified: httpd/httpd/trunk/modules/cache/cache_util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/cache/cache_util.c?rev=1069942&r1=1069941&r2=1069942&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/cache/cache_util.c (original)
+++ httpd/httpd/trunk/modules/cache/cache_util.c Fri Feb 11 20:12:39 2011
@@ -540,8 +540,16 @@ int cache_check_freshness(cache_handle_t
         maxage_req = cache->control_in.max_age_value;
     }
 
-    /* extract max-age from response */
-    maxage_cresp = h->cache_obj->info.control.max_age_value;
+    /*
+     * extract max-age from response, if both s-maxage and max-age, s-maxage
+     * takes priority
+     */
+    if (smaxage != -1) {
+        maxage_cresp = smaxage;
+    }
+    else {
+        maxage_cresp = h->cache_obj->info.control.max_age_value;
+    }
 
     /*
      * if both maxage request and response, the smaller one takes priority
@@ -585,15 +593,14 @@ int cache_check_freshness(cache_handle_t
         minfresh = 0;
     }
 
-    /* override maxstale if must-revalidate or proxy-revalidate */
+    /* override maxstale if must-revalidate, proxy-revalidate or s-maxage */
     if (maxstale && (h->cache_obj->info.control.must_revalidate
-            || h->cache_obj->info.control.proxy_revalidate)) {
+            || h->cache_obj->info.control.proxy_revalidate || smaxage != -1)) {
         maxstale = 0;
     }
 
     /* handle expiration */
-    if (((smaxage != -1) && (age < (smaxage - minfresh))) ||
-        ((maxage != -1) && (age < (maxage + maxstale - minfresh))) ||
+    if (((maxage != -1) && (age < (maxage + maxstale - minfresh))) ||
         ((smaxage == -1) && (maxage == -1) &&
          (info->expire != APR_DATE_BAD) &&
          (age < (apr_time_sec(info->expire - info->date) + maxstale - minfresh)))) {
@@ -606,8 +613,7 @@ int cache_check_freshness(cache_handle_t
                       apr_psprintf(r->pool, "%lu", (unsigned long)age));
 
         /* add warning if maxstale overrode freshness calculation */
-        if (!(((smaxage != -1) && age < smaxage) ||
-              ((maxage != -1) && age < maxage) ||
+        if (!(((maxage != -1) && age < maxage) ||
               (info->expire != APR_DATE_BAD &&
                (apr_time_sec(info->expire - info->date)) > age))) {
             /* make sure we don't stomp on a previous warning */



Re: svn commit: r1069942 - in /httpd/httpd/trunk: CHANGES modules/cache/cache_util.c

Posted by Eric Covener <co...@gmail.com>.
On Fri, Feb 11, 2011 at 3:12 PM,  <mi...@apache.org> wrote:
> Author: minfrin
> Date: Fri Feb 11 20:12:39 2011
> New Revision: 1069942
>
> URL: http://svn.apache.org/viewvc?rev=1069942&view=rev
> Log:
> mod_cache: Respect s-maxage as described by RFC2616 14.9.3, which must
> take precedence if present. PR 35247.
>
> Modified:
>    httpd/httpd/trunk/CHANGES
>    httpd/httpd/trunk/modules/cache/cache_util.c
>
> Modified: httpd/httpd/trunk/CHANGES
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1069942&r1=1069941&r2=1069942&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/CHANGES [utf-8] (original)
> +++ httpd/httpd/trunk/CHANGES [utf-8] Fri Feb 11 20:12:39 2011
> @@ -2,9 +2,8 @@
>
>  Changes with Apache 2.3.11
>
> -  *) mod_ssl: Fix a possible startup failure if multiple SSL vhosts
> -     are configured with the same ServerName and private key file.
> -     [Masahiro Matsuya <mmatsuya redhat.com>, Joe Orton]
> +  *) mod_cache: Respect s-maxage as described by RFC2616 14.9.3, which must
> +     take precedence if present. PR 35247. [Graham Leggett]
>

inadvertently removed

Re: svn commit: r1069942 - in /httpd/httpd/trunk: CHANGES modules/cache/cache_util.c

Posted by Graham Leggett <mi...@sharp.fm>.
On 11 Feb 2011, at 10:17 PM, Jim Jagielski wrote:

>> Changes with Apache 2.3.11
>>
>> -  *) mod_ssl: Fix a possible startup failure if multiple SSL vhosts
>> -     are configured with the same ServerName and private key file.
>> -     [Masahiro Matsuya <mmatsuya redhat.com>, Joe Orton]
>> +  *) mod_cache: Respect s-maxage as described by RFC2616 14.9.3,  
>> which must
>> +     take precedence if present. PR 35247. [Graham Leggett]
>>
>>  *) mod_socache_dc: Make module compile by fixing some typos.
>>     PR 50735 [Mark Montague <mark catseye.org>]
>>
>
> Why the removal of the mod_ssl entry?

Eek, how did that happen. Fixed in r1069947.

Regards,
Graham
--


Re: svn commit: r1069942 - in /httpd/httpd/trunk: CHANGES modules/cache/cache_util.c

Posted by Jim Jagielski <ji...@jaguNET.com>.
On Feb 11, 2011, at 3:12 PM, minfrin@apache.org wrote:

> ==============================================================================
> --- httpd/httpd/trunk/CHANGES [utf-8] (original)
> +++ httpd/httpd/trunk/CHANGES [utf-8] Fri Feb 11 20:12:39 2011
> @@ -2,9 +2,8 @@
> 
> Changes with Apache 2.3.11
> 
> -  *) mod_ssl: Fix a possible startup failure if multiple SSL vhosts
> -     are configured with the same ServerName and private key file.
> -     [Masahiro Matsuya <mmatsuya redhat.com>, Joe Orton]
> +  *) mod_cache: Respect s-maxage as described by RFC2616 14.9.3, which must
> +     take precedence if present. PR 35247. [Graham Leggett]
> 
>   *) mod_socache_dc: Make module compile by fixing some typos.
>      PR 50735 [Mark Montague <mark catseye.org>]
> 

Why the removal of the mod_ssl entry?