summaryrefslogtreecommitdiff
path: root/src/mailman/rest
diff options
context:
space:
mode:
Diffstat (limited to 'src/mailman/rest')
-rw-r--r--src/mailman/rest/tests/test_basic.py4
-rw-r--r--src/mailman/rest/wsgiapp.py29
2 files changed, 5 insertions, 28 deletions
diff --git a/src/mailman/rest/tests/test_basic.py b/src/mailman/rest/tests/test_basic.py
index fade3ed40..23db57f8e 100644
--- a/src/mailman/rest/tests/test_basic.py
+++ b/src/mailman/rest/tests/test_basic.py
@@ -48,8 +48,8 @@ class TestBasicREST(unittest.TestCase):
'A description with , to check stuff')
def test_send_error(self):
- # Test `AdminWebServiceWSGIRequestHandler` `send_error`.
- # Return 400 for invalid url.
+ # GL#288 working around Python bug #28548. The improperly encoded
+ # space in the URL breaks error reporting due to default HTTP/0.9.
with self.assertRaises(HTTPError) as cm:
call_api('http://localhost:9001/3.0/lists/test @example.com')
self.assertEqual(cm.exception.code, 400)
diff --git a/src/mailman/rest/wsgiapp.py b/src/mailman/rest/wsgiapp.py
index e31a46223..3ba122c00 100644
--- a/src/mailman/rest/wsgiapp.py
+++ b/src/mailman/rest/wsgiapp.py
@@ -18,7 +18,6 @@
"""Basic WSGI Application object for REST server."""
import re
-import time
import logging
from base64 import b64decode
@@ -64,8 +63,9 @@ class StderrLogger:
class AdminWebServiceWSGIRequestHandler(WSGIRequestHandler):
- """Handler class which logs output to the right place and prepend headers
- to the error response."""
+ """Handler class which just logs output to the right place."""
+
+ default_request_version = 'HTTP/1.1'
def log_message(self, format, *args):
"""See `BaseHTTPRequestHandler`."""
@@ -76,29 +76,6 @@ class AdminWebServiceWSGIRequestHandler(WSGIRequestHandler):
# the log file.
return StderrLogger()
- def send_error(self, code, message=None, explain=None):
- """See `BaseHTTPRequestHandler`."""
- try:
- shortmsg = self.responses[code][0]
- except KeyError:
- shortmsg = '???'
- err_code = "{0} {1}".format(int(code), shortmsg)
- header_dict = dict(
- status="{0} {1}".format(self.request_version, err_code),
- rsp_date=time.strftime("%a, %d %b %Y %H:%M:%S %Z", time.gmtime()),
- server="{0} {1}".format(self.server_version, self.sys_version),
- content_type=self.error_content_type)
- # Prepare headers and prepend it to the error response body
- error_headers = ("""\
-%(status)s
-Date: %(rsp_date)s
-Server: %(server)s
-content-type: %(content_type)s\n
-""" % header_dict)
- self.error_message_format = error_headers + self.error_message_format
- # Let parent method handle rest of the logic
- super().send_error(code, message, explain)
-
class Middleware:
"""Falcon middleware object for Mailman's REST API.