Skip to content

Allow option to allow spaces after header name for requests #3834

Description

@SnehaGithub

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: seanmonstar/httparse#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.

Activity

  1. seanmonstar commented on Sep 18, 2026

    @seanmonstar
    Member

    I suppose an explicit option to opt-in to cray-cray header spacing in requests would be fine, since one exists for responses. Anyone motivated can make the PRs similar to the response side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-featureCategory: feature. This is adding a new feature.E-pr-welcomeEffort: a pull request is welcome.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions