Fix HTTP protocol plugin always responding with HTTP/1.0 (issue #391)#455
Open
p-alik wants to merge 2 commits into
Open
Fix HTTP protocol plugin always responding with HTTP/1.0 (issue #391)#455p-alik wants to merge 2 commits into
p-alik wants to merge 2 commits into
Conversation
When a client sends an HTTP/1.1 request, the server was unconditionally writing HTTP/1.0 in the response status line. Track the client's protocol version in a new _http_11 member and echo it back in all response paths. HTTP/1.1 responses also include Connection: close since persistent connections are not yet implemented. Adds two regression tests that send HTTP/1.0 and HTTP/1.1 requests respectively and assert the matching version appears in the response. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Alexei Pastuchov <info@maximka.de>
Member
|
This looks good at first glance, but comments: There are already two http tests in t/unitttest. Do you think it makes sense to keep the http tests together? I never realized any tests rely on curl being installed. Is curl installed in the CI workflow? If not, it should be. |
The curl-based httpd tests (including the new regression tests for issue #391) check for /usr/bin/curl and skip silently if absent. Ubuntu/Alpine container images don't have it by default, so those tests were never actually running in containerised CI builds. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Alexei Pastuchov <info@maximka.de>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
HTTP/1.0in every response status line, even when the client sent anHTTP/1.1request._http_11boolean member toHTTPtextthat is set during request parsing whenHTTP/1.1is detected, and used inpack()to echo the correct version back.Connection: closesince persistent connections are not yet implemented (the#if 0keep-alive block remains as-is).Test plan
tests/httpd_test.ccunder theregressioncollection:issue#391 HTTP/1.0 request gets HTTP/1.0 response— sendscurl --http1.0 --includeand asserts response starts withHTTP/1.0issue#391 HTTP/1.1 request gets HTTP/1.1 response— sendscurl --http1.1 --includeand asserts response starts withHTTP/1.1and containsConnection: closet/httpdto confirm existing and new tests passFixes #391
🤖 Generated with Claude Code