Skip to content

Conversation

@prabhleen0601-stack
Copy link

RFC 9110 defines HTTP header field names as tokens, which must not contain '@'.

Currently '@' is accepted because of MIME separator handling.

This patch ensures ParseRules::is_http_field_name rejects '@', aligning behavior with RFC 9110.

This prevents invalid header names from being accepted.

RFC 9110 defines HTTP header field names as tokens, which must not contain '@'.

Currently '@' is accepted because of MIME separator handling.

This patch ensures ParseRules::is_http_field_name rejects '@', aligning behavior with RFC 9110.

This prevents invalid header names from being accepted.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes HTTP header field name validation to comply with RFC 9110 by rejecting the '@' character. The current implementation incorrectly accepts '@' due to MIME separator handling logic.

Changes:

  • Removed the exception that allowed '@' in HTTP header field names
  • Updated the validation logic to properly reject all MIME separators including '@'

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

{
#ifndef COMPILE_PARSE_RULES
return (parseRulesCType[static_cast<unsigned char>(c)] & is_token_BIT);
return (parseRulesCType[(unsigned char)c] & is_token_BIT);
Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed from static_cast<unsigned char> to C-style cast (unsigned char). C++ best practice is to use static_cast for type safety and clarity. This change appears unrelated to the PR's stated purpose of fixing '@' validation.

Suggested change
return (parseRulesCType[(unsigned char)c] & is_token_BIT);
return (parseRulesCType[static_cast<unsigned char>(c)] & is_token_BIT);

Copilot uses AI. Check for mistakes.
{
#ifndef COMPILE_PARSE_RULES
return (parseRulesCType[static_cast<unsigned char>(c)] & is_token_BIT);
return (parseRulesCType[(unsigned char)c] & is_token_BIT);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no C casts, please

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants