Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Ensure CRLF check only performed on string headers
  • Loading branch information
tadejmagajna committed Dec 11, 2025
commit 6d661e892d7969daca0a8e7e761cd91ddf69a962
2 changes: 1 addition & 1 deletion Lib/http/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@

def _validate_header_string(value):
"""Validate header values preventing CRLF injection."""
if '\r' in value or '\n' in value:
if isinstance(value, str) and ('\r' in value or '\n' in value):
raise ValueError('Invalid header name/value: contains CR or LF')

class HTTPServer(socketserver.TCPServer):
Expand Down
Loading