mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #715] [CLOSED] serve: say Connection: close on every response #2782
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#2782
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/715
Author: @evaanp
Created: 10/4/2026
Status: ❌ Closed
Base:
main← Head:pr/connection-close📝 Commits (1)
730b6f9serve: say Connection: close on every response📊 Changes
2 files changed (+40 additions, -0 deletions)
View changed files
📝
serve/server.py(+8 -0)📝
serve/test_server.py(+32 -0)📄 Description
What
The server speaks HTTP/1.0 and closes the connection after every response, but it never said so: no
Connectionheader. A client that pools connections can then hand the socket back to its pool and put its next request on it
before the server's close has reached it. That request fails with "the response ended prematurely", and the
server never reads it, so nothing shows in its log.
end_headersnow addsConnection: closeto every response (JSON, SSE, 204), which tells a pooling client not toreuse the socket.
Measured
On our client, an agent app on .NET 10 (
SocketsHttpHandler) with several background tasks queued behind oneanother: 25 of ~1,000 requests in one night failed this way, each 1-24 ms after the previous response had
completed, and none of them reached the engine. Reproduced with a server in the same style (
BaseHTTPRequestHandler,HTTP/1.0) that delays its close by 10 ms to stand in for the network: 200 of 400 back-to-back requests failed
without the header, 0 with it.
Two tests (
ConnectionClose: a non-streamed and a streamed answer carry the header); both fail without the change.python -m unittest serve.test_server: 120 passed.Developed with an AI coding assistant; measured on Linux, a .NET 10 client against the server on a Ryzen 7 9700X.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.