Repository navigation
h3: deliver $res->sendFile() over HTTP/3 (#60) - #64
Merged
Merged
Conversation
The H3 static-file pump (http3_static_response.c, registered in the h3_stream_ops vtable) was complete but never invoked: h3_handler_coroutine_ dispose never checked http_response_has_send_file() nor called http_send_file_dispatch(). sendFile() over H3 therefore returned 200 with an empty body and no FIN. Wire it the way H2 does (h2_sendfile_arm / on_done): in the buffered dispose branch hand off to the pump via http_send_file_dispatch with an on_done that runs the deferred dispose tail. submit_response reads s->response_zv live and the pump submits asynchronously, so the dispose must NOT drop the response zval or release the stream when it hands off — the tail (extracted into h3_dispose_tail) runs from on_done once the file has streamed. An arm failure (synthesized 500) falls through to the regular buffered submit. Re-enables tests/phpt/server/h3/026 (sendFile byte-integrity across the 16 KiB chunk boundary). h3 phpt 26/26; c=16 sendFile load 4000/4000 2xx, 0 errored; sustained c=64 sendFile — no crash. Static mount auto-routing (addStaticHandler / http_static_try_serve in the H3 dispatch) remains a follow-up under #60.
Contributor
CoverageTotal lines: 80.86% → 80.77% (-0.09 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.
Wires
$res->sendFile()to the H3 static-file pump. Previously sendFile over H3 returned200+ empty body + no FIN.What was wrong
The H3 pump (
http3_static_response.c, in theh3_stream_opsvtable via.send_static_response) was fully written but never invoked —h3_handler_coroutine_disposenever checkedhttp_response_has_send_file()/ calledhttp_send_file_dispatch(). H1/H2 do.Fix
Mirror H2 (
h2_sendfile_arm/h2_sendfile_on_done): in the buffered dispose branch, hand off to the pump viahttp_send_file_dispatchwith anon_donethat runs the deferred dispose tail. Becausesubmit_responsereadss->response_zvlive and the pump submits asynchronously, the dispose must not drop the response zval / release the stream on hand-off — the tail (extracted intoh3_dispose_tail) runs fromon_doneafter the file streams. Arm-failure (synthesized 500) falls through to the buffered submit. Same async-refcount care as #62.Verification
tests/phpt/server/h3/026— sendFile byte-integrity (sha1) across sizes 1 / 16383 / 16384 / 16385 / 49152 / 50000 (the 16 KiB chunk boundary).Follow-up (still under #60)
Static mount auto-routing (
addStaticHandler→http_static_try_servein the H3 dispatch, like H2) — separate, smaller commit.Addresses #60.