Skip to content

Commit 6d661e8

Browse files
committed
Ensure CRLF check only performed on string headers
1 parent 5e56689 commit 6d661e8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Lib/http/server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114

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

120120
class HTTPServer(socketserver.TCPServer):

0 commit comments

Comments
 (0)