WIP: Make Header Indexing Case-Insensitive in tus Client #812
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.
I realize this may be somewhat contentious, but I wanted to start with a workable solution before opening the discussion.
According to the HTTP/1.1 specification, header field names are case-insensitive, while in HTTP/2 they are required to be lowercase.
Currently, the tus client relies on case-sensitive indexing of headers, which causes issues in environments where backend stacks normalize headers to lowercase — a behavior already adopted by many frameworks and servers.
This PR introduces support for case-insensitive header lookups by normalizing header keys to lowercase when performing lookups.
⚙️ Summary
Ensures compatibility with HTTP/1.1 and HTTP/2 expectations
Fixes issues in backend setups where headers are automatically rewritten to lowercase
Aligns tus client behavior with common practice across HTTP client and server libraries
💬 Feedback Welcome
If there’s another approach the maintainers would prefer, please let me know — I’m happy to adjust the implementation to align with your preferred style or design direction.