Skip to content

gh-54930: Send a status line in error responses to malformed request lines#152980

Merged
serhiy-storchaka merged 1 commit into
python:mainfrom
serhiy-storchaka:gh-54930-http09-error-status
Jul 5, 2026
Merged

gh-54930: Send a status line in error responses to malformed request lines#152980
serhiy-storchaka merged 1 commit into
python:mainfrom
serhiy-storchaka:gh-54930-http09-error-status

Conversation

@serhiy-storchaka

@serhiy-storchaka serhiy-storchaka commented Jul 3, 2026

Copy link
Copy Markdown
Member

Previously, if the request line could not be parsed (malformed or unsupported version, bad syntax, or a non-GET two-word request), the error response was sent in the bare HTTP/0.9 style, without a status line and headers, because the request version defaulted to "HTTP/0.9". The client received raw HTML and could not see the 400 or 505 status.

Now only a valid HTTP/0.9 request (a two-word GET request line) receives an HTTP/0.9 style response.

The other defect discussed in the issue (deadlock on a one-line HTTP/0.9 request) was fixed in gh-70765. The test suite previously worked around the present defect by setting default_request_version = 'HTTP/1.1' in its test handlers.

🤖 Generated with Claude Code

…quest lines

Previously such error responses were sent in the bare HTTP/0.9 style,
without a status line and headers.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@serhiy-storchaka serhiy-storchaka added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes labels Jul 3, 2026
@serhiy-storchaka serhiy-storchaka merged commit 2ab620b into python:main Jul 5, 2026
59 checks passed
@miss-islington-app

Copy link
Copy Markdown

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14, 3.15.
🐍🍒⛏🤖

@serhiy-storchaka serhiy-storchaka deleted the gh-54930-http09-error-status branch July 5, 2026 10:48
@bedevere-app

bedevere-app Bot commented Jul 5, 2026

Copy link
Copy Markdown

GH-153092 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label Jul 5, 2026
@bedevere-app

bedevere-app Bot commented Jul 5, 2026

Copy link
Copy Markdown

GH-153093 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Jul 5, 2026
@bedevere-app

bedevere-app Bot commented Jul 5, 2026

Copy link
Copy Markdown

GH-153094 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 bugs and security fixes label Jul 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant