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

Header Validations #123

Open
guybedford opened this issue Jul 31, 2024 · 2 comments
Open

Header Validations #123

guybedford opened this issue Jul 31, 2024 · 2 comments

Comments

@guybedford
Copy link
Contributor

guybedford commented Jul 31, 2024

Some questions with regards to header validations:

  • Valid headers keys must not include whitespace
  • Valid header values must have whitespace trimmed

Possible clarifications that therefore might be made:

Keys

Values

  • Could clarify that they are always trimmed by \t, , \r\ and \n
  • Could clarify that they contain no inner \0, \r or \n.

Without the above assumptions, returning values to the user risks returning invalid values from a get() or entries() call, making any fetch-based Headers implementation on top of these primitives non-standard.

@guybedford guybedford changed the title Can it be assumed that field keys have whitespace trimmed? Can it be assumed that fields have whitespace trimmed? Aug 2, 2024
@guybedford guybedford changed the title Can it be assumed that fields have whitespace trimmed? Header Validations Aug 2, 2024
@guybedford
Copy link
Contributor Author

I've updated the description here to separately consider keys and values.

@lukewagner
Copy link
Member

Good point, I think we do need to tighten this up in the prose wording. I think the appropriate rule is that any field-key parameter (which we need to rename to field-name: #107) in wasi-http needs to be validated to match the field-name grammar in RFC 9110 (which ends up disallowing whitespace, to your point) and, similarly, any field-value parameter in wasi-http must match the field-value grammar in RFC 9110 (which ends up requiring the trimming), with a failure to match returning invalid-syntax.

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 a pull request may close this issue.

2 participants