httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rahul <ra...@Sun.COM>
Subject Re: Fix mod_expires to set correct expires date (PR41391)
Date Thu, 28 Aug 2008 10:32:55 GMT
| While reviewing the patch for PR41391 
| (https://issues.apache.org/bugzilla/show_bug.cgi?id=41391),
| I noticed that besides a possible overflow, it could happen that the 
| expires date is in the past
| (just take an old file and say modification plus 1 minute). What we really 
| want to say in this
| situation is that the resource is already expired. To state this RF2616 
| 14.21 says that the
| Expires header should be set to the same value as the Date header.
| The following patch fixes this and ensures that max-age will be zero in 
| this situation:
 
You are right, But do we really need to check for apocalypse ? :)

| +     * We had an overflow again. So we seem to be less then a year from
| +     * APR_INT64_MAX
| +     */
| +    if (expires < 0) {
| +        expires = APR_INT64_MAX;
| +    }

Secondly it may be useful to say this instead.

+ max_expiry_time = r->request_time + apr_time_from_sec(SECS_PER_YEAR);
+ if ((expires < 0) || (expires > max_expiry_time)) {
+      expires = max_expiry_time;
+ }

to make sure that we dont overshoot the margin of 1 year.


Mime
View raw message