rahul
Thu, 28 Aug 2008 03:47:30 -0700
| 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.