Skip to content

test(win): h2 conditional ETag via curl --config (fix static/012 on Windows)#89

Merged
EdmondDantes merged 1 commit into
mainfrom
windows-h2-test-etag-config
Jun 6, 2026
Merged

test(win): h2 conditional ETag via curl --config (fix static/012 on Windows)#89
EdmondDantes merged 1 commit into
mainfrom
windows-h2-test-etag-config

Conversation

@EdmondDantes
Copy link
Copy Markdown
Contributor

Problem

static/012-static-h2 fails on Windows: the conditional GET (If-None-Match with the response's ETag) returns a stream PROTOCOL_ERROR instead of a clean 304.

The root cause is in the test, not the server. An ETag is W/"hex", and PHP's escapeshellarg() on Windows cannot carry a double quote — it replaces every " with a space. So If-None-Match: W/"hex" reaches curl as W/ hex . Leading/trailing whitespace in an HTTP/2 field value is malformed per RFC 9113 §8.2.1, and the server's nghttp2 correctly rejects the stream with PROTOCOL_ERROR. On Linux escapeshellarg wraps args in single quotes, preserving the ", which is why it only failed on Windows.

Confirmed: sending the same ETag with the quotes preserved (manual \" escaping / curl --config) yields a clean 304 in-process. The server is RFC-correct.

Fix (test-only)

Route -H request headers through a curl --config file, whose quoting is shell-independent, so the quoted ETag survives on every platform. The rest of the invocation (prior-knowledge h2c, -i, -I HEAD, byte ranges) is unchanged.

Full coverage is preserved — 304-via-If-None-Match, 206/416 ranges, HEAD, 404, index — and no server code changes.

Verification (Windows, Debug_TS)

  • static/012-static-h2: red → green, 3/3 stable
  • full static/ suite: 20 pass / 0 fail / 4 skip

…ed -H

static/012-static-h2 failed on Windows: the conditional GET (If-None-Match
with the response ETag) came back as a stream PROTOCOL_ERROR instead of a
clean response. The root cause is in the test, not the server. An ETag is
`W/"hex"`, and PHP's escapeshellarg() on Windows cannot carry a double
quote — it replaces every " with a space, so `If-None-Match: W/"hex"`
reached curl as `W/ hex `. Leading/trailing whitespace in a field value is
malformed per RFC 9113 §8.2.1, and the server's nghttp2 correctly rejects
the stream with PROTOCOL_ERROR. On Linux escapeshellarg wraps args in
single quotes, preserving the " — which is why this only failed on Windows.

Fix (test-only): route -H request headers through a curl --config file,
whose quoting is shell-independent, so the quoted ETag survives on every
platform. Full coverage (304-via-If-None-Match, byte ranges, HEAD) is
preserved; the server is unchanged and behaves correctly per spec.

Verified on Windows: static/012-static-h2 red->green (3/3); full static/
suite 20 pass / 0 fail / 4 skip.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 6, 2026

Coverage

Total lines: 79.58% → 79.72% (+0.13 pp)

File Baseline Current Δ Touched
src/core/http_connection.c 68.44% 70.40% +1.97 pp

@EdmondDantes EdmondDantes merged commit 043f60d into main Jun 6, 2026
8 checks passed
@EdmondDantes EdmondDantes deleted the windows-h2-test-etag-config branch June 6, 2026 11:17
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.

1 participant