On 10/29/2008 02:32 PM, [EMAIL PROTECTED] wrote:
> Author: jim
> Date: Wed Oct 29 06:32:58 2008
> New Revision: 708902
> 
> URL: http://svn.apache.org/viewvc?rev=708902&view=rev
> Log:
> Avoid time traveling :)
> 
> Modified:
>     httpd/httpd/trunk/modules/metadata/mod_expires.c
> 
> Modified: httpd/httpd/trunk/modules/metadata/mod_expires.c
> URL: 
> http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/metadata/mod_expires.c?rev=708902&r1=708901&r2=708902&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/modules/metadata/mod_expires.c (original)
> +++ httpd/httpd/trunk/modules/metadata/mod_expires.c Wed Oct 29 06:32:58 2008
> @@ -430,6 +430,9 @@
>      }
>  
>      expires = base + additional;
> +    if (expires < r->request_time) {
> +        expires = r->request_time;
> +    }
>      apr_table_mergen(t, "Cache-Control",
>                       apr_psprintf(r->pool, "max-age=%" APR_TIME_T_FMT,
>                                    apr_time_sec(expires - r->request_time)));
> 

This causes failures in the perl framework:

t/modules/expires.t                92   15  16.30%  4 10 14 17-18 22 29-30 34-
                                                    35 38 42 46 48 50

But IMHO the code is now correct after the patch and the tests are wrong. The 
following
patch makes the tests pass again:

Index: t/modules/expires.t
===================================================================
--- t/modules/expires.t (Revision 707830)
+++ t/modules/expires.t (Arbeitskopie)
@@ -231,6 +231,13 @@
     if ($exp_conf =~ /^([A|M])(\d+)$/) {
         $exp_type = $1;
         $expected = $2;
+        ## With modification date as base expire times can be in the past
+        ## Correct behaviour for the server in this case is to set expires
+        ## time equal to access time.
+        if (($exp_type eq 'M')
+            && ($headers{access} > $headers{modified} + $expected)) {
+            $expected = $headers{access} - $headers{modified};
+        }
     } else {
         print STDERR "\n\ndoom: $exp_conf\n\n";
         return 0;

Comments?

Regards

RĂ¼diger

Reply via email to