Repository navigation
Compare HTTP header names case-insensitively - #205
Merged
Merged
Conversation
Owner
Author
|
GitHub CI did not run, so here are local results on macOS 26.6.2, Apple clang 21.0.0 (Release, clean configure, all targets including examples and benchmarks built).
Sanity run of |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Request and response header maps in
coroio/http/httpd.hppnow use an ASCII case-insensitive transparent comparator (THeaderNameLess).New aliases:
THeaders(request,std::string_viewkeys, returned byTRequest::Headers()) andTResponseHeaders(response,std::stringkeys).Why
Header field names are case-insensitive (RFC 9110, section 5.1). Before,
Content-Length,Transfer-EncodingandConnectionlookups missedcontent-lengthand similar spellings, so such requests were parsed without a body. The same applied toSetHeader("content-type", ...)afterSetHeader("Content-Type", ...), which produced two headers.Behaviour notes
chunked,close) are still compared exactly, as before.Tests
tests/test_http.cpp:test_http_headers_case_insensitive(mixed-case request names, lookup by other case, body read viaCONTENT-LENGTH),test_http_response_headers_case_insensitive(duplicate names in different case, serialization). Existing serialization tests are unchanged and pass;ut_test_http: 16/16 passed.