pquerna / cachecontrol

Golang HTTP Cache-Control Parser and Interpretation
Apache License 2.0
138 stars 17 forks source link

Gracefully handle bad values in Expires header #6

Closed mbyczkowski closed 7 years ago

mbyczkowski commented 7 years ago

Looking at RFC7234 (https://tools.ietf.org/html/rfc7234#section-5.3):

A cache recipient MUST interpret invalid date formats, especially the value "0", as representing a time in the past (i.e., "already expired").

This change sets Expires header to "zero" time for any invalid date input.

pquerna commented 7 years ago

Great patch and thanks for adding a test case!