Skip to content

net.http: fix server_tls h2-negotiation test for default-on HTTP/2#27393

Merged
JalonSolov merged 1 commit into
vlang:masterfrom
quaesitor-scientiam:fix-server-tls-h2-test
Jun 8, 2026
Merged

net.http: fix server_tls h2-negotiation test for default-on HTTP/2#27393
JalonSolov merged 1 commit into
vlang:masterfrom
quaesitor-scientiam:fix-server-tls-h2-test

Conversation

@quaesitor-scientiam

Copy link
Copy Markdown
Contributor

Problem

test_server_tls_h2_negotiation (vlib/net/http/server_tls_test.v) is currently red on master CI — clang-linux, gcc-linux, tcc-linux, clang-macos:

vlib/net/http/server_tls_test.v:138: fn test_server_tls_h2_negotiation
   > assert resp_h1.version() == .v1_1
     Left value (len: 8): `HTTP/2.0`
    Right value (len: 8): `HTTP/1.1`

The test was written before #27384 and assumed a plain http.fetch() (no enable_http2 field) is served as HTTP/1.1. #27384 flipped enable_http2 to default true, so the client now advertises h2 via ALPN by default and the server correctly upgrades — making the .v1_1 assertion fail.

Fix

The server behavior is correct; the test just needs to opt out of HTTP/2 explicitly on the leg that means to exercise the HTTP/1.1 path. Pass enable_http2: false on the resp_h1 fetch (and update the comment to match). The h2 leg above it already passes enable_http2: true, so both directions are now covered explicitly.

Verification

v test vlib/net/http/server_tls_test.v passes; v fmt -verify clean.

🤖 Generated with Claude Code

test_server_tls_h2_negotiation asserted that a plain `http.fetch()` (no
`enable_http2` field) is served as HTTP/1.1. That held before vlang#27384, but
vlang#27384 flipped `enable_http2` to default `true`, so the client now advertises
`h2` ALPN by default and the server correctly upgrades — making the test's
`resp_h1.version() == .v1_1` assertion fail. This is currently red on master
CI (clang/gcc/tcc-linux, clang-macos).

The server behavior is correct; the test just needs to opt out explicitly.
Pass `enable_http2: false` on the HTTP/1.1 leg, which is what the test means
to exercise (server still serves h1 to a client that does not negotiate h2).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.

@JalonSolov JalonSolov merged commit 1e95770 into vlang:master Jun 8, 2026
75 of 83 checks passed
dy-tea pushed a commit to wenxuanjun/v that referenced this pull request Jun 19, 2026
…lang#27393)

test_server_tls_h2_negotiation asserted that a plain `http.fetch()` (no
`enable_http2` field) is served as HTTP/1.1. That held before vlang#27384, but
vlang#27384 flipped `enable_http2` to default `true`, so the client now advertises
`h2` ALPN by default and the server correctly upgrades — making the test's
`resp_h1.version() == .v1_1` assertion fail. This is currently red on master
CI (clang/gcc/tcc-linux, clang-macos).

The server behavior is correct; the test just needs to opt out explicitly.
Pass `enable_http2: false` on the HTTP/1.1 leg, which is what the test means
to exercise (server still serves h1 to a client that does not negotiate h2).

Co-authored-by: Richard Wheeler <quaesitor.scientiam@gmail.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
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