Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Looser case parsing (Postel's Law)? #15

Open
cbiffle opened this issue Jan 26, 2024 · 1 comment
Open

Looser case parsing (Postel's Law)? #15

cbiffle opened this issue Jan 26, 2024 · 1 comment

Comments

@cbiffle
Copy link

cbiffle commented Jan 26, 2024

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 of httpdate 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!

@pyfisch
Copy link
Owner

pyfisch commented Feb 9, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants