Repository navigation
Conversation
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.
A client currently treats a provisional HTTP response such as
103 Early Hintsas a rejected upgrade and moves toCLOSED. If the101arrives in the same read, callers instead receive a spuriousRejectConnectionbeforeAcceptConnection.Keep the handshake pending for informational responses other than
101. RFC 6455 section 4.1 delegates non-101 responses to HTTP procedures, and RFC 9110 section 15.2 requires clients to handle interim responses before the final response:The existing 101 validation and final HTTP rejection paths are unchanged. Replace the test that expected a 102 rejection with coverage for multiple interim responses, statuses 100/102/103/199, separate/coalesced reads, and final 101/403 responses. Update the affected event documentation and changelog.
Minimal reproduction on the base revision:
Before:
CLOSEDand aRejectConnection(status_code=103, has_body=False)event. After:CONNECTINGand no events, waiting for the upgrade or final HTTP response.Validation on macOS/CPython 3.13.12:
python -bb -m pytest --cov=wsproto --cov-report=term --cov-report=xml: 245 passed, total coverage unchanged at 97%.mypy src/, Sphinx HTML build, andgit diff --check: passed.Other Python versions and platforms have not been tested locally. Hosted CI and maintainer review remain pending.
AI disclosure: AI agents investigated the bug, wrote the patch and regression tests, ran the checks, and drafted this PR. A separate AI agent performed an automated review of the patch. Maintainer review is requested.