hyper::Error should distinguish http1 TooLarge from other parse errors
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.3k
- Forks
- 1.8k
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 14
Description
Currently if an http1 message head exceeds the http1_max_buf_size, a hyper::Error is returned where err.is_parse() == true. This is indistinguishable from other errors that httparse might bubble up, which poses a problem for deciding how to respond to these errors. A TooLarge can occur just because of the choices made when setting up the max buffer size (many implementations default to 1MB vs the ~400KB default for hyper), vs. an actually malformed HTTP message which probably indicates a misbehaving server.
Could we add a new method to hyper::Error that distinguishes these? hyper::Error::is_buf_size_exceeded() as a strawman?
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
No file or test path is named. Start by tracing the http1 parsing path where httparse errors become hyper::Error, then inspect how the TooLarge condition is represented. Define and test a distinction between buffer-size exhaustion and malformed-message parse errors, using the proposed Error method as the target API.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100