launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #19727
[Merge] lp:~cjwatson/launchpad/xmlrpc-allow-parameters into lp:launchpad
Colin Watson has proposed merging lp:~cjwatson/launchpad/xmlrpc-allow-parameters into lp:launchpad.
Commit message:
Accept XML-RPC requests with parameters in their Content-Type.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/xmlrpc-allow-parameters/+merge/277526
git.qastaging.paddev.net broke after upgrading to Twisted 15.4.0. The problem is that Twisted 15.3.0 changed (as part of a Python 3 port of twisted.web.xmlrpc) to sending "Content-Type: text/xml; charset=utf-8" in XML-RPC requests rather than just "Content-Type: text/xml", and Launchpad is excessively picky about this. There's no reason not to accept parameters in Content-Type here.
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/xmlrpc-allow-parameters into lp:launchpad.
=== modified file 'lib/lp/services/webapp/doc/webapp-publication.txt'
--- lib/lp/services/webapp/doc/webapp-publication.txt 2014-09-01 03:41:31 +0000
+++ lib/lp/services/webapp/doc/webapp-publication.txt 2015-11-16 03:40:49 +0000
@@ -395,6 +395,12 @@
PublicXMLRPCPublication
>>> print_request_and_publication(
+ ... 'xmlrpc.launchpad.dev', method='POST',
+ ... mime_type='text/xml; charset=utf-8')
+ PublicXMLRPCRequest
+ PublicXMLRPCPublication
+
+ >>> print_request_and_publication(
... 'xmlrpc.launchpad.dev', method='GET')
ProtocolErrorRequest
ProtocolErrorPublication: status=405
@@ -429,6 +435,12 @@
PrivateXMLRPCRequest
PrivateXMLRPCPublication
+ >>> print_request_and_publication(
+ ... 'xmlrpc-private.launchpad.dev', port=private_port, method='POST',
+ ... mime_type='text/xml; charset=utf-8')
+ PrivateXMLRPCRequest
+ PrivateXMLRPCPublication
+
A request to an unknown host results in a 404 error.
>>> print_request_and_publication('nosuchhost.launchpad.dev')
=== modified file 'lib/lp/services/webapp/servers.py'
--- lib/lp/services/webapp/servers.py 2015-10-11 20:06:23 +0000
+++ lib/lp/services/webapp/servers.py 2015-11-16 03:40:49 +0000
@@ -419,7 +419,7 @@
environment))
if request_factory is None:
mime_type = environment.get('CONTENT_TYPE')
- if mime_type != 'text/xml':
+ if mime_type.split(';')[0].strip() != 'text/xml':
request_factory = ProtocolErrorRequest
# 415 - Unsupported Media Type
publication_factory = ProtocolErrorPublicationFactory(415)
Follow ups