Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
Set `Connection: closed` when running without request queueing #2216
When running with
Specifically the behaviour that we want here is:
As part of doing this change, I've refactored the logic around setting the connection headers to make it easier to understand why the headers are set the way they are. I've pulled this into a separate commit (345e127, which is intended to purely be a refactor and to have no functional effect). In general, this PR is probably best reviewed commit-by-commit.
The motivation for making this change is that this could previously cause clients which looked at this header to attempt to reuse connections which the server had closed. Clients that do this would get sent a TCP RST packet for their troubles, and would raise an exception.
Your checklist for this pull request
This helps make it clearer how this branching works, and explicitly documents that this is a difference in which default HTTP 1.0 vs 1.1 assume.
When running with queue_requests=false, make the Connection header reflect that the server will close the connection after the request is completed. (This is required by https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html, specifically: "HTTP/1.1 applications that do not support persistent connections MUST include the "close" connection option in every message.") This could previously cause clients which looked at this header to attempt to reuse connections which the server had closed.
Oof - the latest build failure is an error from inside of Ragel, from a different test: https://github.com/puma/puma/pull/2216/checks?check_run_id=557243347
Great! All builds pass - so it seems like I was just getting unlucky. (This issue looks maybe related #2148, but honestly I don't really know.) I might try taking a swing at debugging what's going on here - but for now, this PR is ready for review.