Barry Warsaw pushed to branch master at mailman / Mailman
Commits: 94d0949a by amitt001 at 2016-10-30T18:11:34-04:00 Rest api send error response with headers - - - - - 61347daf by amitt001 at 2016-10-30T18:11:34-04:00 Test invalid url response. - - - - - 7c0cbd97 by amitt001 at 2016-10-30T18:11:34-04:00 qa fix - - - - - 2545dc1e by amitt001 at 2016-10-30T18:11:34-04:00 < python 3.5.x non-enum HTTPStatus support - - - - - a93b1b43 by amitt001 at 2016-10-30T18:11:34-04:00 qa fix: unused variable - - - - - 76d8d7d7 by Barry Warsaw at 2016-10-30T18:19:16-04:00 Support HTTP/1.1 by default. This works around Python issue 28548 and fixes #288. Test given by Amit. - - - - - 3 changed files: - src/mailman/docs/NEWS.rst - src/mailman/rest/tests/test_basic.py - src/mailman/rest/wsgiapp.py Changes: ===================================== src/mailman/docs/NEWS.rst ===================================== --- a/src/mailman/docs/NEWS.rst +++ b/src/mailman/docs/NEWS.rst @@ -175,6 +175,7 @@ REST 3.0 except that UUIDs are represented as hex strings instead of 128-bit integers, since the latter are not compatible with all versions of JavaScript. (Closes #121) + * REST clients must minimally support HTTP/1.1. (Closes #288) * The new template system is introduced for API 3.1. See ``src/mailman/rest/docs/templates.rst`` for details. (Closes #249) * When creating a user via REST using an address that already exists, but ===================================== src/mailman/rest/tests/test_basic.py ===================================== --- a/src/mailman/rest/tests/test_basic.py +++ b/src/mailman/rest/tests/test_basic.py @@ -26,6 +26,7 @@ from mailman.app.lifecycle import create_list from mailman.database.transaction import transaction from mailman.testing.helpers import call_api from mailman.testing.layers import RESTLayer +from urllib.error import HTTPError class TestBasicREST(unittest.TestCase): @@ -45,3 +46,10 @@ class TestBasicREST(unittest.TestCase): # This fails with Falcon 0.2; passes with Falcon 0.3. self.assertEqual(self._mlist.description, 'A description with , to check stuff') + + def test_send_error(self): + # 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) ===================================== src/mailman/rest/wsgiapp.py ===================================== --- a/src/mailman/rest/wsgiapp.py +++ b/src/mailman/rest/wsgiapp.py @@ -65,6 +65,8 @@ class StderrLogger: class AdminWebServiceWSGIRequestHandler(WSGIRequestHandler): """Handler class which just logs output to the right place.""" + default_request_version = 'HTTP/1.1' + def log_message(self, format, *args): """See `BaseHTTPRequestHandler`.""" log.info('%s - - %s', self.address_string(), format % args) View it on GitLab: https://gitlab.com/mailman/mailman/compare/d2418de626e51f76cf33c6d93b80e7968c356c97...76d8d7d71b6573b9d36c4a280fb50f61f92764e0
_______________________________________________ Mailman-checkins mailing list Mailman-checkins@python.org Unsubscribe: https://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org