Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3fb066d

Browse files
committed
Fix Issue #12921: BaseHTTPServer's send_error should send the correct error
response message when send_error includes a message in addition to error status. Patch contributed by Karl.
1 parent 44d5214 commit 3fb066d

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

Lib/http/server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ def send_error(self, code, message=None):
421421
# using _quote_html to prevent Cross Site Scripting attacks (see bug #1100201)
422422
content = (self.error_message_format %
423423
{'code': code, 'message': _quote_html(message), 'explain': explain})
424-
self.send_response(code, message)
424+
self.send_response(code, shortmsg)
425425
self.send_header("Content-Type", self.error_content_type)
426426
self.send_header('Connection', 'close')
427427
self.end_headers()

Misc/NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,10 @@ Core and Builtins
233233
Library
234234
-------
235235

236+
- Issue #12921: BaseHTTPServer's send_error should send the correct error
237+
response message when send_error includes a message in addition to error
238+
status. Patch submitted by Karl.
239+
236240
- Issue #17278: Fix a crash in heapq.heappush() and heapq.heappop() when
237241
the list is being resized concurrently.
238242

0 commit comments

Comments
 (0)