Skip to content

Validate HTTP/2 header casing and lowercase default user-agent - #22

Open
vincenthawke wants to merge 1 commit into
DemonMartin:mainfrom
vincenthawke:main
Open

Validate HTTP/2 header casing and lowercase default user-agent#22
vincenthawke wants to merge 1 commit into
DemonMartin:mainfrom
vincenthawke:main

Conversation

@vincenthawke

@vincenthawke vincenthawke commented Aug 12, 2026

Copy link
Copy Markdown

Added HTTP/2 header casing validation to the SessionClient constructor. When forceHttp1 is false, both defaultHeaders and connectHeaders are checked, and an error is thrown if any header name is not lowercase.

Renamed the user-agent header in DEFAULT_OPTIONS.defaultHeaders to lowercase.

No header casing validation is performed when forceHttp1 is true, since HTTP/1.1 does not require lowercase header names

Summary by CodeRabbit

  • Bug Fixes
    • Standardized the default User-Agent header key to lowercase.
    • Added validation for default and CONNECT header names when HTTP/1 is not forced, preventing invalid non-lowercase headers.

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@vincenthawke, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 40 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 80fe857a-f273-4672-9669-2bab382e324e

📥 Commits

Reviewing files that changed from the base of the PR and between 400d5cc and ea0c4d9.

📒 Files selected for processing (1)
  • src/index.ts
📝 Walkthrough

Walkthrough

The client now uses a lowercase user-agent header by default. SessionClient rejects non-lowercase default and CONNECT headers when HTTP/1 is not forced.

Changes

HTTP Header Validation

Layer / File(s) Summary
Default headers and casing validation
src/index.ts
The default User-Agent header is now user-agent. SessionClient combines default and CONNECT header names and rejects non-lowercase names unless forceHttp1 is enabled.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: claude

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes both main changes: HTTP/2 header casing validation and the lowercase default user-agent header.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/index.ts`:
- Around line 565-573: Update the header validation condition near allHeaders so
validation runs whenever options.forceHttp1 is not true, including when it is
omitted, while still skipping it for explicit true. Add tests covering omitted
forceHttp1 and uppercase defaultHeaders/connectHeaders, explicit false, and
explicit true.
- Line 511: Update the README defaultHeaders example to use the lowercase
`user-agent` header key instead of `User-Agent`, keeping the documented
`forceHttp1: false` configuration unchanged.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9181c361-454d-4d58-8a85-bb52b139a136

📥 Commits

Reviewing files that changed from the base of the PR and between ca9e54c and 400d5cc.

📒 Files selected for processing (1)
  • src/index.ts

Comment thread src/index.ts
Comment thread src/index.ts
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