test: cover RST_STREAM and the Content-Length-mismatch arm of h2 header-time completion
What does this PR do?
Test-only follow-up to #36941 (the header-time terminal detach fix in the HTTP/2/3 fetch client). Review of that change found two halves of its contract unasserted; this adds both to test/js/web/fetch/fetch-http2-adversarial.test.ts:
-
RST_STREAM on completion. When a
Content-Length: 0response completes at header time the stream is still open from the server's side, so the deliver loop abandons it withRST_STREAM(CANCEL); without that the server is left holding the stream half-open againstMAX_CONCURRENT_STREAMS. The existing test now asserts the server receivedRST_STREAM(CANCEL)on stream 1, matching thestate.rstassertions the suite already has for the other two detach-leaves-stream-open paths. -
Coalesced stray DATA. New test: the same
content-length: 0+ SSE HEADERS with a 1-byte DATA frame in the same TLS record. The stray byte contradicts the declared length, sofinish_streamrejects withHTTP2ContentLengthMismatch(RFC 9113 section 8.1.1). The head is already valid when the mismatch is detected, sofetch()resolves and the error lands on the body read, mirroring the existing mid-body mismatch behavior. This arm of the #36941 branch had no coverage.
How did you verify your code works?
Both tests pass 3/3 consecutive runs against the debug+ASAN build on current main, and the whole fetch-http2-adversarial.test.ts file passes (17 tests).
Note for the fail-before check: the fix these tests cover is already merged (#36941), so there is no in-tree revision where they fail without a src change. On the pre-#36941 tree both scenarios crash the child with the client.h2.is_none() teardown assertion rather than producing the asserted outputs.
no test proof · iteration 1 · Platform-specific test-only change; deferring to CI.