Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ext): support non-canonical HTTP/1 reason phrases #2792

Merged

Commits on Jun 8, 2022

  1. feat(ext): support non-canonical HTTP/1 reason phrases

    Add a new extension type `hyper::ext::ReasonPhrase` gated by either the `ffi` or `http1` Cargo
    features. When enabled, store any non-canonical reason phrases in this extension when parsing
    responses, and write this reason phrase instead of the canonical reason phrase when emitting
    responses.
    
    Reason phrases are a disused corner of the spec that implementations ought to treat as opaque blobs
    of bytes. Unfortunately, real-world traffic sometimes does depend on being able to inspect and
    manipulate them.
    
    Non-canonical reason phrases are checked for validity at runtime to prevent invalid and dangerous
    characters from being emitted when writing responses. An `unsafe` escape hatch is present for hyper
    itself to create reason phrases that have been parsed (and therefore implicitly validated) by
    httparse.
    acfoltzer committed Jun 8, 2022
    Configuration menu
    Copy the full SHA
    6ed3a7f View commit details
    Browse the repository at this point in the history