Skip to content

gh-150679: reject CR and LF in http.server send_header and send_response_only#150680

Closed
metsw24-max wants to merge 1 commit into
python:mainfrom
metsw24-max:reject-crlf-in-http-server-send-header
Closed

gh-150679: reject CR and LF in http.server send_header and send_response_only#150680
metsw24-max wants to merge 1 commit into
python:mainfrom
metsw24-max:reject-crlf-in-http-server-send-header

Conversation

@metsw24-max
Copy link
Copy Markdown

send_header() and send_response_only() interpolate the keyword, value and reason phrase straight into the header and status lines, so a CR or LF reflected from a request injects extra headers or splits the response. http.client.putheader, wsgiref.headers and http.cookies already reject control characters here; these two writers were the holdouts. Reject CR and LF in the supplied arguments, matching the rest of the stdlib.

@picnixz
Copy link
Copy Markdown
Member

picnixz commented May 31, 2026

This is known and documented. We are NOT going to fix this because people may want this behavior just for testing purposes.

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