Repository navigation
Conversation
When the push callback returned CURL_PUSH_ERROROUT, the return code was overwritten by the result of nghttp2_submit_rst_stream(), so the check for CURL_PUSH_ERROROUT could never match and the parent transfer completed successfully instead of failing as documented in CURLMOPT_PUSHFUNCTION.
There was a problem hiding this comment.
🟡 Changes recommended
The newly reachable error path can fail an unrelated multiplexed transfer instead of recording the error on the parent.
1 open issue
What changed in this PR
This PR fixes HTTP/2 push handling so CURL_PUSH_ERROROUT reaches the parent-transfer error path.
Changes:
- Preserves the push callback result separately from the stream-reset result.
- Keeps fatal reset-submission error handling intact.
| File | Description |
|---|---|
| lib/http2.c | Separates callback and nghttp2 return values during push rejection. |
Review effort: Balanced
| h2rv = nghttp2_submit_rst_stream(ctx->h2, NGHTTP2_FLAG_NONE, | ||
| frame->push_promise.promised_stream_id, | ||
| NGHTTP2_CANCEL); | ||
| if(nghttp2_is_fatal(h2rv)) |
Contributor
Author
There was a problem hiding this comment.
I changed it to store the error in the parent stream's xfer_result and mark it dirty, so the parent transfer fails with CURLE_RECV_ERROR and other streams are unaffected. With the push callback returning CURL_PUSH_ERROROUT the parent now fails with 56, and CURL_PUSH_DENY still completes normally.
Returning an error from the frame callback fails nghttp2 input processing for the whole connection, so the error could be reported on whichever transfer happened to drive the session. Store it in the parent stream's xfer_result instead and mark the parent dirty, so it is reported on the parent transfer only.
icing
approved these changes
Oct 19, 2026
Member
|
Thanks! |
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.

When a
CURLMOPT_PUSHFUNCTIONcallback returnsCURL_PUSH_ERROROUT, the documentation says it "rejects the pushed stream and returns an error back on the parent stream making it get closed with an error". In practice the pushed stream is rejected, but the parent transfer finishes withCURLE_OK.In
on_stream_frame(), the callback's return value inrvis overwritten by the return value ofnghttp2_submit_rst_stream(), which is 0 on success. So therv == CURL_PUSH_ERROROUTcheck right after it can never match, and theCURLE_RECV_ERRORpath is unreachable. This change keeps the nghttp2 return value in a separate variable.I checked it with a small multi program whose push callback returns
CURL_PUSH_ERROROUT, againstnghttpd --no-tls -p /=/pushed.txtusingCURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE:CURLE_OK(0)CURLE_RECV_ERROR(56)CURL_PUSH_DENYstill leaves the parent transfer atCURLE_OKI did not add a test, as the existing push tests in
tests/http/test_09_push.pyneed httpd with mod_http2, which I could not run locally. I'm happy to add a case there if that's wanted.The issue was found with an LLM-assisted static analysis tool and verified manually.