Skip to content

Broker host: case-insensitive header lookup - #119

Open
andre-merzky wants to merge 1 commit into
develfrom
fix/broker-host-header-case
Open

Broker host: case-insensitive header lookup#119
andre-merzky wants to merge 1 commit into
develfrom
fix/broker-host-header-case

Conversation

@andre-merzky

Copy link
Copy Markdown
Member

First live run of a dispatcher pool behind the DT service hit submit_rh with HTTP 500: 'utf-8' codec can't decode byte 0x81 in position 0.

Root cause: BrokerPluginHost.handle_request looks up content-type in the caller's header dict. The gateway path is normalised by starlette, but the in-process BrokerCaller path passes the dict verbatim — Content-Type: application/msgpack missed the lookup, the msgpack body fell to the JSON default, and json.loads died on the first msgpack byte. The repeated submit failures then failed the engine, which closed the session and tore down the pool.

Fix: lowercase the header keys before the lookup. Headers are still not forwarded into the RequestShim — a client-supplied x-orbit-src must not surface as a trusted owner on this path (documented in place).

Tests: two new (msgpack body with capitalized Content-Type — reproduces the failure against the unfixed code — and the JSON default). Full suite: 1029 passed.

🤖 Generated with Claude Code

https://claude.ai/code/session_016Npyz3Hbnwos12ESsdJ2YU

The gateway path goes through starlette, which lowercases header names;
an in-process caller (BrokerCaller) hands its dict to handle_request
verbatim.  A client sending 'Content-Type: application/msgpack' missed
the lowercase lookup, the body fell through to the JSON default, and
json.loads died on the first msgpack byte as invalid utf-8 -- the
task dispatcher's rhapsody-dialect bulk submit hit exactly this from
the DT service's pool-backed engine (first live pool run).

Headers are still not passed into the RequestShim: a client-supplied
x-orbit-src must not surface as a trusted owner on this path.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016Npyz3Hbnwos12ESsdJ2YU
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.

1 participant