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

Handle multiple headers with the same name #1084

Conversation

TontonJambon
Copy link

According to the RFC 9110, multiple headers with the same name can be found in an HTTP Request :

Example-Field: Foo, Bar
Example-Field: Baz

As the current implementation of parseHeader (util.cpp) uses a map, only the last value is kept. However, section 5.3 of linked RFC tells that we can just append the fields using comma SP as separator and keep the semantic. This is what I propose in this PR.

@TontonJambon TontonJambon force-pushed the fix/multiple_header_with_same_name branch from b1131ed to 15ae2b9 Compare July 18, 2024 08:48
@COM8
Copy link
Member

COM8 commented Jul 21, 2024

@TontonJambon thank you very much for contributing this!

Sadly I have a few issues with it.

  1. Just appending them with a , is not convenient for parsing later on. Instead I suggest switching the std::string to a std::vector or std::variant<std::string, std::vector>?
  2. Please fix all existing tests.
  3. Please add new test cases for this feature.

@COM8
Copy link
Member

COM8 commented Aug 17, 2024

Closing for no response. Feel free to reopen in case you want to continue working on it.

@COM8 COM8 closed this Aug 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants