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

The empty string is rejected as header values #115

Closed
hiroshige-g opened this issue Sep 1, 2015 · 9 comments
Closed

The empty string is rejected as header values #115

hiroshige-g opened this issue Sep 1, 2015 · 9 comments

Comments

@hiroshige-g
Copy link

Header value definition is updated (#99 and #100) as:

A value is a byte sequence that matches the field-content token production.
https://fetch.spec.whatwg.org/#concept-header-value

But this change rejects the empty string as header values (as well as whitespace-only header values before normalization), because field-content in RFC 7230 doesn't match the empty string.
According to web-platform-tests/wpt#2045, it seems we expect to accept the empty string and whitespace-only strings as setRequestHeader() etc., so should we modify header value concept to accept the empty string?

@annevk
Copy link
Member

annevk commented Sep 1, 2015

That's a good point. I changed to field-content from field-value to avoid obs-fold. Perhaps I should say *field-content instead?

@hiroshige-g
Copy link
Author

*field-content

Probably.

Mentioning that *field-content is equal to

a byte sequence that matches the field-value token production and contains no 0x0A or 0x0D bytes.

(the previous definition of header value, if we interpret them using RFC 7230) or "*field-value with *obs-fold disallowed" might help readers to understand why *field-content is used here.

@hiroshige-g
Copy link
Author

Correction: "field-value with obs-fold disallowed"

@hiroshige-g
Copy link
Author

We are going to update the header value checks.
Can we assume this issue is accepted, i.e. the empty string is a valid header value?

@annevk
Copy link
Member

annevk commented Sep 10, 2015

Yes. I'm working on integrating Fetch into HTML at the moment, which is taking its time. Will probably get back to Fetch after that. Alternatively, if you want, you are encouraged to provide PRs.

@annevk
Copy link
Member

annevk commented Sep 16, 2015

@hiroshige-g do you mind if I wait with updating this until Chrome has updated its implementation? I'd like to know if this is compatible or if we need to do something else.

@mnot
Copy link
Member

mnot commented Nov 11, 2015

FWIW - empty header fields do happen, but our (HTTPWG folks') anecdotal experience, their handling (in lots of places) is very unreliable. As a result, our usual advice is to avoid them (e.g., Foo: 1 if necessary). YMMV (and not saying that you shouldn't do this).

@hiroshige-g
Copy link
Author

Oh, sorry I missed the comment #115 (comment).

As for this issue of the empty header values, Chromium implementation accepts empty values since long time ago. Also Firefox seems to accept the empty header values in Fetch API.

Updating header values checks to RFC 7230 (#99 and #100) is another issue, and Chromium implementation hasn't yet follow the spec update.

@annevk
Copy link
Member

annevk commented Aug 12, 2016

I'm duplicating this against #332 as that has considerable more information on the standards situation.

@annevk annevk closed this as completed Aug 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants