Skip to content

Ignore empty members of the Accept header - #610

Closed
dominikklein wants to merge 1 commit into
modelcontextprotocol:mainfrom
dominikklein:ignore_empty_accept_header_members
Closed

dominikklein wants to merge 1 commit into
modelcontextprotocol:mainfrom
dominikklein:ignore_empty_accept_header_members

Conversation

@dominikklein

Copy link
Copy Markdown

An empty member in the Accept header (application/json,,text/event-stream or , application/json, text/event-stream) made parse_accept_header call strip on nil, and the transport answered 500 with Internal server error. Empty members are now skipped, as RFC 9110 asks ("a recipient MUST parse and ignore a reasonable number of empty list elements", section 5.6.1.2), so such a request is checked like any other. A transport test covers a header with both kinds.

Fixes #609.

An empty list member made parse_accept_header call strip on nil, so the
transport answered 500. RFC 9110 asks recipients to ignore them.

Fixes modelcontextprotocol#609.
@koic

koic commented Oct 15, 2026

Copy link
Copy Markdown
Member

Closing in favor of #616, which skips empty members the same way and also covers the GET path, where the same header did not answer 500 but raised out of the transport, since handle_get has no rescue.

#616 also adds a regression test for that GET case next to the POST ones, with the doubled and the leading comma checked separately.

Thank you for the report and the RFC 9110 reference in #609.

@koic koic closed this Oct 15, 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.

Empty members in the Accept header cause a 500

2 participants