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

Error in parse headers(headers) : header contains invalid character. #132

Closed
AlexandreBeaudoin opened this issue Mar 11, 2020 · 2 comments · Fixed by #133 or #135
Closed

Error in parse headers(headers) : header contains invalid character. #132

AlexandreBeaudoin opened this issue Mar 11, 2020 · 2 comments · Fixed by #133 or #135
Assignees
Milestone

Comments

@AlexandreBeaudoin
Copy link

It looks like my headers include the underscore character '_' and I get the following error
"Error in parse headers(headers) : header contains invalid character."

After modifying parse_headers.cpp:

bool validate_header_name(const std::string& x) {
  auto check = [&](char c) { return std::isalpha(c) || c == '-' || c == '_'; };
  return std::all_of(x.begin(), x.end(), check);
}

I no longer get that error.

@dselivanov dselivanov self-assigned this Mar 12, 2020
@dselivanov dselivanov added the bug label Mar 12, 2020
@dselivanov
Copy link
Collaborator

Thanks for reporting! you are right, according to rfc7230 header name may consists of:

     token          = 1*tchar

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

@artemklevtsov artemklevtsov self-assigned this Mar 12, 2020
@artemklevtsov artemklevtsov added this to the 0.2.0.3 milestone Mar 12, 2020
artemklevtsov added a commit that referenced this issue Mar 14, 2020
* Fix #132
* Add test for the invalid header name
* Bump version
@artemklevtsov artemklevtsov linked a pull request Mar 14, 2020 that will close this issue
@artemklevtsov
Copy link
Collaborator

Fix in the dev branch now.

@dselivanov dselivanov mentioned this issue Mar 19, 2020
@artemklevtsov artemklevtsov modified the milestones: 0.2.0.3, 0.2.1 Mar 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants