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

Update header value validation to match WHAT-WG fetch spec #97

Open
njsmith opened this issue Jan 16, 2020 · 3 comments
Open

Update header value validation to match WHAT-WG fetch spec #97

njsmith opened this issue Jan 16, 2020 · 3 comments

Comments

@njsmith
Copy link
Member

njsmith commented Jan 16, 2020

Header values are a mess. Supposedly they're defined by RFC 7230, but in fact it has a bug and its definition is obviously wrong. And, in practice, implementations are substantially more lax than RFC 7230, even after you fix the obvious bug.

In #57/#68, we adjusted our validation rule to allow more characters, based on some intuition and a small amount of new data (e.g. we allow \x01, which is used by google analytics cookies, but still disallow \x00).

But, it turns out that the WHAT-WG fetch spec has an actual precise definition for header values: https://fetch.spec.whatwg.org/#concept-header-value

Weird that it's here instead of in some HTTP spec, but I'll take it.

I think there are two differences between what h11 does currently and the WHAT-WG spec:

We should probably switch to matching the WHAT-WG behavior exactly.

@SyntaxColoring
Copy link

@njsmith Out of curiosity, what exactly is the bug in the RFC 7230 definition, and why is the definition obviously wrong?

@njsmith
Copy link
Member Author

njsmith commented Feb 18, 2020

The spec accidentally disallows any header value that contains a single character word inside it. For example, this is not a valid header would be an illegal header value, because the word a is only one character long.

@mnot
Copy link

mnot commented Jul 31, 2023

RFC7230 is obsolete; the specification you want is here.

Regarding single word field values -- how do you come to that conclusion?

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

3 participants