Skip to content

Fix HTTP protocol plugin always responding with HTTP/1.0 (issue #391)#455

Open
p-alik wants to merge 2 commits into
masterfrom
fix/issue-391-http-version-in-response
Open

Fix HTTP protocol plugin always responding with HTTP/1.0 (issue #391)#455
p-alik wants to merge 2 commits into
masterfrom
fix/issue-391-http-version-in-response

Conversation

@p-alik

@p-alik p-alik commented Jun 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • The HTTP protocol plugin unconditionally wrote HTTP/1.0 in every response status line, even when the client sent an HTTP/1.1 request.
  • Added a _http_11 boolean member to HTTPtext that is set during request parsing when HTTP/1.1 is detected, and used in pack() to echo the correct version back.
  • HTTP/1.1 responses now also include Connection: close since persistent connections are not yet implemented (the #if 0 keep-alive block remains as-is).

Test plan

  • Two new regression tests in tests/httpd_test.cc under the regression collection:
    • issue#391 HTTP/1.0 request gets HTTP/1.0 response — sends curl --http1.0 --include and asserts response starts with HTTP/1.0
    • issue#391 HTTP/1.1 request gets HTTP/1.1 response — sends curl --http1.1 --include and asserts response starts with HTTP/1.1 and contains Connection: close
  • Run t/httpd to confirm existing and new tests pass

Fixes #391

🤖 Generated with Claude Code

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>
@esabol

esabol commented Jun 20, 2026

Copy link
Copy Markdown
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>
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.

Using HTTP protocol, if the client sends HTTP/1.1, the server answers with HTTP/1.0

2 participants