Safeguard interim header callbacks for unregistered handlers#142
Open
kedar49 wants to merge 1 commit into
Open
Safeguard interim header callbacks for unregistered handlers#142kedar49 wants to merge 1 commit into
kedar49 wants to merge 1 commit into
Conversation
Interim 1xx responses can arrive even when the simple client has not registered a handler yet. Guarding the session callback keeps those responses from crashing the client while preserving late callback registration for existing streams. Fixes google#103
Author
|
@RyanTheOptimist you can review and merge this PR |
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.
Summary:
This fixes a crash in the simple QUIC client when it receives a valid interim
1xxresponse and no interim-header callback has been registered. The crash happened becauseQuicSimpleClientSessionalways installed a stream callback, but that callback unconditionally invoked an empty session-levelMultiUseCallback. The fix routes interim-header delivery through a guarded session helper so missing callbacks become a no-op, while preserving the existing late-binding behavior for streams that were created before a callback is registered.Changes:
quiche/quic/tools/quic_simple_client_session.hMaybeNotifyInterimHeaders(const quiche::HttpHeaderBlock&)helper declaration.quiche/quic/tools/quic_simple_client_session.ccCreateClientStream()to forward interim headers throughMaybeNotifyInterimHeaders(...)instead of directly invokingon_interim_headers_.MaybeNotifyInterimHeaders(...)before invoking the session callback.quiche/quic/core/http/quic_spdy_client_stream_test.ccTestQuicSimpleClientSessiontest scaffolding for exercising the simple-client path.InterimResponseWithoutCallbackDoesNotCrashSimpleClientto verify a valid1xxresponse is stored without crashing when no callback is registered.InterimResponseCallbackUsesLatestSessionHandlerto verify late callback registration still works and clearing the callback stops further notifications without affecting interim-header storage.Testing:
git diff --check/home/kedar/.cache/bazelisk/downloads/sha256/7ff2b6a675b59a791d007c526977d5262ade8fa52efc8e0d1ff9e18859909fc0/bin/bazel --output_base=/tmp/quiche-bazel-out --install_base=/tmp/quiche-bazel-install test //quiche:quic_spdy_client_stream_testInterimResponseWithoutCallbackDoesNotCrashSimpleClientInterimResponseCallbackUsesLatestSessionHandlerCloses #103