Skip to content

Disallow '@' in HTTP/1 header field-names per RFC 9110#12881

Closed
dweepvira wants to merge 1 commit intoapache:masterfrom
dweepvira:fix-disallow-at-in-header-name
Closed

Disallow '@' in HTTP/1 header field-names per RFC 9110#12881
dweepvira wants to merge 1 commit intoapache:masterfrom
dweepvira:fix-disallow-at-in-header-name

Conversation

@dweepvira
Copy link

Disallow @ in HTTP/1 header field-names per RFC 9110

Summary

Disallow the @ character in HTTP/1 header field-names to ensure compliance with RFC 9110.

Background

RFC 9110 defines:

field-name = token

Where token consists only of tchar characters:

tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*"
      / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~"
      / DIGIT / ALPHA

The @ character is not included in the tchar set and therefore is not valid in HTTP header field-names.

The current implementation of ParseRules::is_http_field_name() explicitly allows @ as an exception:

(is_mime_sep(c) && c != '@')

This results in HTTP/1 requests such as:

To@st: value

being accepted instead of rejected.

Change

Remove the special-case allowance for @ in ParseRules::is_http_field_name().

Before:

(is_mime_sep(c) && c != '@')

After:

is_mime_sep(c)

This ensures that @ is rejected as part of HTTP/1 header field-names.

Result

Requests containing header names with @ now correctly return:

400 Invalid HTTP Request

instead of being processed normally.

Scope

  • Minimal change
  • No structural modifications
  • No parser architecture changes
  • Strict RFC 9110 compliance enforcement

Impact

Improves HTTP/1 standards compliance by rejecting syntactically invalid header field-names.

RFC 9110 specifies that HTTP header field-names must consist only
of tchar. The current implementation explicitly allows '@' in
header names due to a special-case condition in
ParseRules::is_http_field_name() during parse table generation.

This patch removes the exception for '@', ensuring header name
validation aligns with RFC 9110.

Invalid header names now correctly result in HTTP 400 responses.
@bneradt
Copy link
Contributor

bneradt commented Feb 12, 2026

Thank you for the contribution, but ATS uses @ headers for internal communication and we cannot have the parser being incapable of parsing them. We closed an almost identical PR recently: #12838

@bneradt bneradt closed this Feb 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants