test(win): h2 conditional ETag via curl --config (fix static/012 on Windows)#89
Merged
Merged
Conversation
…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.
Contributor
CoverageTotal lines: 79.58% → 79.72% (+0.13 pp)
|
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.
Problem
static/012-static-h2fails on Windows: the conditional GET (If-None-Matchwith the response's ETag) returns a stream PROTOCOL_ERROR instead of a clean304.The root cause is in the test, not the server. An ETag is
W/"hex", and PHP'sescapeshellarg()on Windows cannot carry a double quote — it replaces every"with a space. SoIf-None-Match: W/"hex"reaches curl asW/ 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 withPROTOCOL_ERROR. On Linuxescapeshellargwraps 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 clean304in-process. The server is RFC-correct.Fix (test-only)
Route
-Hrequest headers through a curl--configfile, whose quoting is shell-independent, so the quoted ETag survives on every platform. The rest of the invocation (prior-knowledge h2c,-i,-IHEAD, byte ranges) is unchanged.Full coverage is preserved —
304-via-If-None-Match,206/416ranges, HEAD, 404, index — and no server code changes.Verification (Windows, Debug_TS)
static/012-static-h2: red → green, 3/3 stablestatic/suite: 20 pass / 0 fail / 4 skip