hyperium / hyperium/hyper

hyper::Error should distinguish http1 TooLarge from other parse errors

Open
#2,462 11 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-error
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.