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

Rephrase exception messages related to non empty header values #38

Merged
merged 1 commit into from May 21, 2018

Conversation

sunkan
Copy link
Contributor

@sunkan sunkan commented Apr 18, 2018

It looks like the RFC-7230 require header-value to be at least 1 charecter long. But I might be wrong.

What I can find most clients/librarys allow sending of empty header values

  • curl allow you to send empty headers
  • Firefox allows it for xhr/fetch with the motivation We need it to be compliant with the XHR spec: "The empty string is legal and represents the empty header value."
  • From the firefox thread it seams like Chrome also support sending and reciving empty header values
  • Guzzle support sending empty header-value Empty headers support guzzle/guzzle#1915

@Zegnat
Copy link
Collaborator

Zegnat commented Apr 19, 2018

Ha, that RFC feels a little misleading. It says:

Each header field consists of a case-insensitive field name followed by a colon (":"), optional leading whitespace, the field value, and optional trailing whitespace.

Which sure does sound like a “field value” is mandatory. But then they define field value as:

     field-value    = *( field-content / obs-fold )

Note the * there. A field-value contains 0 to infinite (RFC 5234, §3.6.) other things. Zero. An empty field-value is a valid field-value.

So yes, we should definitely allow empty headers when following the RFC that PSR-7 it written against. Nice work! 👍

@Nyholm
Copy link
Owner

Nyholm commented May 21, 2018

Excellent. Thank you both!

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

Successfully merging this pull request may close these issues.

None yet

3 participants