You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ji...@apache.org on 2008/10/29 14:32:59 UTC
svn commit: r708902 - /httpd/httpd/trunk/modules/metadata/mod_expires.c
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)));
Re: svn commit: r708902 - /httpd/httpd/trunk/modules/metadata/mod_expires.c
Posted by Jim Jagielski <ji...@jaguNET.com>.
On Nov 1, 2008, at 6:54 AM, Ruediger Pluem wrote:
>
> 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?
>
Thanks! I forgot to mention that the test cases were bad, and had
intended
to fix them, but time got away from me. Thanks for following
up!
+1
Re: svn commit: r708902 - /httpd/httpd/trunk/modules/metadata/mod_expires.c
Posted by Justin Erenkrantz <ju...@erenkrantz.com>.
On Sat, Nov 1, 2008 at 4:54 AM, Ruediger Pluem <rp...@apache.org> wrote:
> But IMHO the code is now correct after the patch and the tests are wrong. The following
> patch makes the tests pass again:
+1. -- justin
Re: svn commit: r708902 - /httpd/httpd/trunk/modules/metadata/mod_expires.c
Posted by Ruediger Pluem <rp...@apache.org>.
On 10/29/2008 02:32 PM, jim@apache.org 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