Message171084
Note that forcing a content length on error responses also seems to make wget happy:
diff --git a/Lib/BaseHTTPServer.py b/Lib/BaseHTTPServer.py
--- a/Lib/BaseHTTPServer.py
+++ b/Lib/BaseHTTPServer.py
@@ -362,14 +362,19 @@
message = short
explain = long
self.log_error("code %d, message %s", code, message)
- # using _quote_html to prevent Cross Site Scripting attacks (see bug #1100201)
- content = (self.error_message_format %
- {'code': code, 'message': _quote_html(message), 'explain': explain})
+ if self.command != 'HEAD' and code >= 200 and code not in (204, 304):
+ # using _quote_html to prevent Cross Site Scripting attacks (see bug #1100201)
+ content = (self.error_message_format %
+ {'code': code, 'message': _quote_html(message), 'explain': explain})
+ else:
+ content = None
self.send_response(code, message)
self.send_header("Content-Type", self.error_content_type)
+ if content is not None:
+ self.send_header("Content-Length", str(len(content)))
self.send_header('Connection', 'close')
self.end_headers()
- if self.command != 'HEAD' and code >= 200 and code not in (204, 304):
+ if content is not None:
self.wfile.write(content)
error_message_format = DEFAULT_ERROR_MESSAGE |
|
Date |
User |
Action |
Args |
2012-09-24 00:13:46 | pitrou | set | recipients:
+ pitrou, thomaslee, neologix, catalin.iacob, theamk |
2012-09-24 00:13:42 | pitrou | set | messageid: <1348445622.84.0.483449825934.issue15991@psf.upfronthosting.co.za> |
2012-09-24 00:13:42 | pitrou | link | issue15991 messages |
2012-09-24 00:13:39 | pitrou | create | |
|