Streamable HTTP server: Accept and Content-Type are matched case-sensitively and by substring/prefix
Maintainer antworten meist innerhalb von 3 Tagen
Bewertung
Dieses Issue wurde noch nicht bewertet.
Beschreibung
Version: rmcp 3.6.0 (also 3.5.1), transport-streamable-http-server, StreamableHttpService.
What happens
The POST and GET handlers in crates/rmcp/src/transport/streamable_http_server/tower.rs check Accept and Content-Type with raw string matching:
// POST, Accept
header.contains(JSON_MIME_TYPE) && header.contains(EVENT_STREAM_MIME_TYPE)
// POST, Content-Type
header.starts_with(JSON_MIME_TYPE)
// GET, Accept
header.contains(EVENT_STREAM_MIME_TYPE)
That gives these results:
| Request | Result | Expected |
|---|---|---|
Content-Type: Application/JSON |
415 | accepted |
Accept: APPLICATION/JSON, TEXT/EVENT-STREAM |
406 | accepted |
Content-Type: application/jsonx |
accepted | 415 |
Accept: application/json-seq, text/event-stream |
accepted | 406 |
Accept: application/json;q=0, text/event-stream |
accepted | 406 (q=0 means "not acceptable") |
Accept split across two header lines (application/json and text/event-stream) |
406 (only the first value is read) | accepted |
Expected
RFC 9110 §8.3.1 says the type, subtype and parameter names are case-insensitive. §5.3 allows a list-valued field like Accept to be sent as several field lines, which are equivalent to one comma-joined line. §12.5.1 says q=0 marks a type as not acceptable. Comparing parsed media types would cover all of these. For example: split on , across every Accept value, take the part before ;, trim it, compare with eq_ignore_ascii_case, and skip entries whose q is 0.
Impact
Low. Mainstream clients send lowercase values on a single line, so they work. A proxy or client that normalises header case, or splits Accept into separate lines, gets refused. The prefix and substring matches also let a non-JSON Content-Type through to the JSON deserialiser. That then fails later, with a less useful error.
Repro
curl -i -X POST http://127.0.0.1:8000/mcp \
-H 'Content-Type: Application/JSON' \
-H 'Accept: application/json, text/event-stream' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
# HTTP/1.1 415 Unsupported Media Type
The check runs before the body is read, so the body and protocol headers don't matter.
AI disclosure: written with Claude Code. I reviewed it.
- Vorherrschende Sprache
- Rust
- Sterne
- 4.1k
- Forks
- 694
- Ø Merge
- 4 T. 9 Std.
- Gemergte PRs (30 T.)
- 41
Entwicklungsumgebung
Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus modelcontextprotocol/rust-sdk
-
Support tool exposure modes (direct / deferred / codemode) and client-side aggregation.Evtl. vergeben @jamadeo hat das heute übernommen. Offenenhancement P3 T-model T-service
modelcontextprotocol/rust-sdk#1437 · 1 Kommentar · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 3 Tagen
-
Return MergedList<T> from list_all_* and drop the _with_cache_hint variantsEvtl. vergeben @DaleSeo hat das vor 4 Tagen übernommen. Offenenhancement P3 ready for work T-service v4
modelcontextprotocol/rust-sdk#1430 · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 3 Tagen
-
Server logs a fabricated 'initialize' (with synthesized rmcp/3.8.0 peer identity) for no-initialize SEP-2567 requests, ignoring clientInfo from _metaEvtl. vergeben @jamadeo hat das vor 4 Tagen übernommen. Offenbug P2 ready for work T-service T-transport
modelcontextprotocol/rust-sdk#1425 · 2 Kommentare · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 3 Tagen
-
OAuth discovery drops explicit default ports from advertised issuer identifiersEvtl. vergeben @gocamille hat das vor 6 Tagen übernommen. Offenbug P1 ready for work T-security T-transport
modelcontextprotocol/rust-sdk#1420 · 4 Kommentare · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 3 Tagen
-
`register_client` drops `client_secret_expires_at` from the registration responseEvtl. vergeben @gocamille hat das vor 8 Tagen übernommen. Offenbug P2 ready for work T-security
modelcontextprotocol/rust-sdk#1416 · 1 Kommentar · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 3 Tagen
Alle Issues in modelcontextprotocol/rust-sdk
Ähnliche Issues
-
bug priority: low
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
storytold/photocraft#12183 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 2 Tagen
-
area:render needs-triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
bherbruck/solvecraft#13138 ·
-
testing
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 86/100
ratatui/ratatui-textarea#39 ·
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
transit-audio/transit#369 ·