Allow option to allow spaces after header name for requests
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.3k
- Forks
- 1.8k
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 14
Description
Is your feature request related to a problem? Please describe.
Hi, we have a use case where parsing a request with a single space after header name is expected to succeed.
Currently, given a request with space after header name will fail parsing. Looks like because the space isn't a valid header token and the current allow_spaces_after_header_name check seems to be for responses only. Reference: https://github.com/seanmonstar/httparse/issues/88
Describe the solution you'd like
Could we add an option for allow_spaces_after_header_name_in_requests check?
Effort:
- adding an extra option allow_spaces_after_header_name_in_requests to ParserConfig in httparse
- some modification to the parse function to ignore spaces after the header name if the config option is enabled in httparse
- adding a wrapper function to hyper Builder impl for allowing spaces after header name
Describe alternatives you've considered
ignoring invalid headers and implementing a custom parser, but this is more complicated and inefficient to implement when we could just use an additional option here
Additional context
Add any other context or screenshots about the feature request here.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing ParserConfig and the request parse function in httparse, then inspect the hyper Builder impl that exposes parser options. Confirm how allow_spaces_after_header_name currently applies to responses and identify the corresponding request path. Done means the new option is configurable through hyper and requests with a single space after the header name parse successfully when enabled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- api, backend, networking
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100