Skip to content

fix(http): fall back to :authority for HTTP/2#827

Merged
DaleSeo merged 1 commit intomainfrom
fix/h2-authority-fallback
May 1, 2026
Merged

fix(http): fall back to :authority for HTTP/2#827
DaleSeo merged 1 commit intomainfrom
fix/h2-authority-fallback

Conversation

@DaleSeo
Copy link
Copy Markdown
Member

@DaleSeo DaleSeo commented Apr 30, 2026

Motivation and Context

The DNS-rebinding validator added in PR #764 only checks the Host header. However, in HTTP/2, the host is included in the :authority pseudo-header. Hyper usually copies :authority into Host for application code, but middleware like axum::Router::nest can remove that header before it gets to StreamableHttpService. This can lead to valid H2 traffic being incorrectly rejected with a 400 error. This update modifies parse_host_header to use request.uri().authority() when the Host header is missing.

How Has This Been Tested?

Added a integration test to cover the new path

Breaking Changes

None. It's a change to a private API that won't affect the public interface, and the existing HTTP/1 path remains unchanged.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

@DaleSeo DaleSeo self-assigned this Apr 30, 2026
@DaleSeo DaleSeo requested a review from a team as a code owner April 30, 2026 19:21
@github-actions github-actions Bot added T-test Testing related changes T-core Core library changes T-transport Transport layer changes labels Apr 30, 2026
@DaleSeo DaleSeo mentioned this pull request Apr 30, 2026
9 tasks
alexhancock
alexhancock previously approved these changes May 1, 2026
@DaleSeo DaleSeo force-pushed the fix/h2-authority-fallback branch from 9ec2cec to 307d5bc Compare May 1, 2026 13:04
@alexhancock alexhancock self-requested a review May 1, 2026 13:06
@DaleSeo
Copy link
Copy Markdown
Member Author

DaleSeo commented May 1, 2026

Hey @alexhancock, I've resolved the conflict with my previous PR, but your approval has been dismissed. Could you approve it again?

@DaleSeo DaleSeo merged commit ef74147 into main May 1, 2026
18 checks passed
@DaleSeo DaleSeo deleted the fix/h2-authority-fallback branch May 1, 2026 13:17
@github-actions github-actions Bot mentioned this pull request May 1, 2026
jrmelsha added a commit to UserGeneratedLLC/rmcp-rust-sdk that referenced this pull request May 1, 2026
Brings in upstream rmcp v1.6.0:
- fix(http): fall back to :authority for HTTP/2 (modelcontextprotocol#827)
- fix: add init_timeout for streamable-http sessions (modelcontextprotocol#811)
- feat(http): log Host/Origin rejections (modelcontextprotocol#826)

Conflict resolution:
- crates/rmcp/CHANGELOG.md: kept fork's bare-boolean Unreleased entry,
  inserted upstream's 1.6.0 release section beneath it
- crates/rmcp/src/transport/streamable_http_server/tower.rs:
  auto-merged upstream's Host/Origin/HTTP-2 logging additions; kept
  fork's tracing::debug! for "Resume failed" (ab4ccdb) over upstream's
  tracing::warn! revert
- Cargo.toml workspace bumped to 1.6.0; fork's newer dep versions
  (pastey 0.2.2, schemars 1.2, reqwest 0.13.3, url 2.5,
  process-wrap 9.1, chrono 0.4.44) preserved; rand stays removed
  (ed5868d) since fork doesn't use it
- docs.rs anthropic-ext feature retained
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-core Core library changes T-test Testing related changes T-transport Transport layer changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants