Ipstenu / varnish-http-purge

Proxy Cache Purge
Apache License 2.0
46 stars 47 forks source link

Remove strtotime check on Age header #87

Closed 0x6d617474 closed 4 years ago

0x6d617474 commented 4 years ago

Since the Age header is a non-negative integer, when the value is passed into the strtotime function the values emitted are either invalid or unintended.

Examples:

var_dump(strtotime("56")); # false
var_dump(strtotime("1056")); # 1592902560 (2020-06-23 10:56:00)

Both 56 and 1056 are perfectly valid values for the Age header, yet the plugin debug page will always show a warning that they are invalid because the output of the strtotime function is less than the current time().

Since there is already a check in place to ensure that the value passed in the header is a non-negative integer, this check can safely be removed.