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

Allow exclamation mark as valid header character #745

Merged
merged 1 commit into from May 28, 2020

Conversation

niksudan
Copy link
Contributor

@niksudan niksudan commented Dec 30, 2019

In the section 3.2.6 of the HTTP RFC7230, it denotes the following about HTTP headers:

Most HTTP header field values are defined using common syntax
components (token, quoted-string, and comment) separated by
whitespace or specific delimiting characters. Delimiters are chosen
from the set of US-ASCII visual characters not allowed in a token
(DQUOTE and "(),/:;<=>?@[]{}").

token          = 1*tchar

tchar          = "!" / "#" / "$" / "%" / "&" / "'" / "*"
               / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~"
               / DIGIT / ALPHA
               ; any VCHAR, except delimiters

Note the tchar definition allows use of an exclamation mark, but the validator for normalizeName does not allow it.

This PR adds the exclamation mark to the list of allowed characters to header fields.

Verification

Execute the following in the browser console:

const headers = new Headers();
headers.append('test!', '123'); // Executes fine
headers.append('test:', '123'); // Throws a TypeError

@robjtede
Copy link

+1 on fixing this spec violation

@kruczy
Copy link

kruczy commented Jan 31, 2020

bump, have the same issue with api that sometimes adds a header with a !, this fixes it for me, can it be merged?

Thanks 👍

@JakeChampion JakeChampion merged commit 92d78df into JakeChampion:master May 28, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants