Skip to content

gh-72756: Skip all 1xx interim responses in http.client - #161082

Closed
b84330808 wants to merge 1 commit into
python:mainfrom
b84330808:gh-72756-http-client-1xx
Closed

b84330808 wants to merge 1 commit into
python:mainfrom
b84330808:gh-72756-http-client-1xx

Conversation

@b84330808

@b84330808 b84330808 commented Nov 1, 2026 •

Copy link
Copy Markdown

HTTPResponse.begin() only skips 100 Continue. Any other 1xx response (102 Processing, 103 Early Hints, ...) is returned as the final response, and the real response stays unread on the connection. With urllib it shows up as an error when a server sends 103 Early Hints before 200 OK:

urllib.error.HTTPError: HTTP Error 103: Early Hints

RFC 9110 (section 15.2) says a client must be able to parse 1xx responses that arrive before the final response, and may ignore unexpected ones. This skips every 1xx response the same way 100 Continue is skipped, except 101 Switching Protocols, which is still returned to the caller, as suggested in the issue.

test_httpservers.test_send_error checked a 102 response from http.server through http.client, which can no longer see it, so that case moved to a new test that reads the raw response from the socket.

I used Claude Code to write this change.

HTTPResponse.begin() only skipped "100 Continue", so any other 1xx
response, such as "102 Processing" or "103 Early Hints", was returned as
the final response and the real response was left unread on the
connection. RFC 9110 requires clients to parse 1xx responses received
before the final response, and allows them to ignore unexpected ones.

Skip every 1xx response except "101 Switching Protocols", which is still
returned to the caller.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@picnixz

picnixz commented Nov 1, 2026

Copy link
Copy Markdown
Member

This is a breaking change which was not discussed for a long time. We should first revive the discussion to decide how not to break consumers. Even if we do devite from the RFC, this may be nontrivial.

@picnixz picnixz closed this Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants