Skip to content

Send Connection: keep-alive to an HTTP/1.0 peer whose connection is kept - #268

Merged
lalinsky merged 1 commit into
lalinsky:mainfrom
xuckless:http10-keepalive
Oct 20, 2026
Merged

lalinsky merged 1 commit into
lalinsky:mainfrom
xuckless:http10-keepalive

Conversation

@xuckless

Copy link
Copy Markdown
Contributor

An HTTP/1.0 request with Connection: keep-alive is kept open (llhttp's should_keep_alive says so), but the response doesn't say so. HTTP/1.0 is close-by-default, so the client must assume the server closes after the response (RFC 9112 §9.3 and appendix C.2.2) and waits for an EOF that never comes, while the server waits for the next request. ab -k against any dusty server hangs until apr's poll timeout:

$ ab -k -n 20000 -c 16 http://127.0.0.1:8080/
apr_pollset_poll: The timeout specified has expired (70007)

sendHeader now writes Connection: keep-alive when the response is to an HTTP/1.0 request and the connection is kept. HTTP/1.1 responses are unchanged (no header when kept, Connection: close when not).

Tests: the existing "HEAD streamed to an HTTP/1.0 peer keeps the connection" now checks the header; two new ones cover a buffered HTTP/1.0 response and an HTTP/1.1 response sending no Connection header.

HTTP/1.0 is close-by-default, so a 1.0 client that asked to keep the
connection only reuses it when the response says so (RFC 9112 9.3,
appendix C.2.2). dusty kept such connections open without saying so,
and the client then waited for the server to close it.
@coderabbitai

coderabbitai Bot commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 23 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository: lalinsky/dusty/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 91fee10d-4c68-4ef7-8c2a-b77e46b7f3f2
📥 Commits

Reviewing files that changed from the base of the PR and between d3cb485 and 712dad6.

📒 Files selected for processing: 2
  • CHANGELOG.md
  • src/response.zig
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@lalinsky

lalinsky commented Oct 18, 2026 •

Copy link
Copy Markdown
Owner

I'm confused. I didn't know HTTP/1.0 allows keep-alive?

OH, it does. That's new to me.

@lalinsky
lalinsky merged commit e319833 into lalinsky:main Oct 20, 2026
8 checks passed
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.

2 participants