Commit Graph
1 Commits
Author SHA1 Message Date
Hermes Agent 11f6b31d12 test: drive the rejected-write connection reuse over a real socket
The unit tests in this PR assert `close_connection` is set on each rejection path.
That pins the mechanism but not the consequence: they build a SimpleNamespace,
never open a socket, and would still pass if BaseHTTPRequestHandler stopped
honouring the flag.

This sends a rejected write and then an ordinary GET down one connection. Reusing
it makes the server read the unread body as a request line and answer

    HTTP/1.1 400 Bad request syntax ('{"a": "b"}GET /api/health HTTP/1.1')

an error about a request the client never sent, which is what makes this class of
bug expensive to diagnose. Both directions are pinned: the reusing handler must
produce that 400, the closing handler must not.

The two files are complementary. Reverting server.py fails the unit test; making
the handler here reuse the connection fails this one.
2026-09-22 12:06:08 +00:00