Open cbiffle opened 7 months ago
Hi! Thanks for raising this issue. RFC9111 notes that the Date format is case-sensitive but recommends that caches accept lowercased variants.
Although all date formats are specified to be case-sensitive, a cache recipient SHOULD match the field value case-insensitively.
https://www.rfc-editor.org/rfc/rfc9111.html#name-freshness
I'm glad to review a patch.
Hi! What's your feeling on accepting lowercase variations of the date format?
I'm currently using
httpdate
to parse and compare modified dates for resources in my webserver. Strictly speaking, the HTTP standard says that clients should send back the exact date I previously served them, but in practice I see many clients who don't. In cases where I can figure out what they mean, I'd like to be flexible to increase the chances of a 304 Not Modified. Thus my use ofhttpdate
rather than an exact string compare.However, I'm seeing clients in practice that send all headers lowercased, including the contents of if-modified-since. This means I receive a date that would be otherwise valid, except for letter case.
httpdate
's parser is strict and it rejects these dates. Per Postel's Law I'm going to modify the server to accept lowercase, and I'm trying to figure out if that means I need to fork this crate.Thanks!