gh-54930: Send a status line in error responses to malformed request lines by serhiy-storchaka · Pull Request #152980 · python/cpython · GitHub
Skip to content

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

Open
serhiy-storchaka wants to merge 1 commit into
python:mainfrom
serhiy-storchaka:gh-54930-http09-error-status
Open

gh-54930: Send a status line in error responses to malformed request lines#152980
serhiy-storchaka wants to merge 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting core review 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant