
michael at d2m
May 25, 2009, 8:08 AM
Post #5 of 7
(480 views)
Permalink
|
|
Re: XML-RPC does not work under the paster process
[In reply to]
|
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Christian Theune wrote: > On Wed, 2009-03-18 at 13:12 +0100, Michael Haubenwallner wrote: >> -----BEGIN PGP SIGNED MESSAGE----- >> Hash: SHA1 >> >> Michael Haubenwallner wrote: >>> When using paste.httpserver instead of twisted.wsgi server >>> zope.publisher.xmlrpc.XMLRPCRequest.processInputs() hangs when reading 0 >>> Bytes from the request (wsgi.input <socket._fileobject object>). >>> >>> As i found the zope.publisher.http.HTTPInputStream.readlines() signature >>> was changed 3 years ago >>> from readlines(self, hint=None) >>> to readlines(self, hint=0) >>> http://svn.zope.org/Zope3/trunk/src/zope/publisher/http.py?rev=66941&r1=66940&r2=66941 >>> >>> Do you think we could revert the change? >>> >>> Bugs reported: >>> zopeproject: https://bugs.launchpad.net/zope3/+bug/283089 >>> grokproject: https://bugs.launchpad.net/grok/+bug/332063 >>> >> Bump - maybe my description was too complicated, but the issue is serious: >> >> XMLRPC is broken at least with paste.httpserver >> >> Any input on the implications of reverting the change in revision #66941? > > I've looked at the various APIs of actual objects that need to consume > the size hint parameter (cStringIO, StringIO, file, socket._fileobject). > > All of them should be fine getting a 0 as an argument, but file and > cStringIO will break if they get `None` instead of 0: > > Type | readlines() | readlines(None) | readlines(0) > ------------------------+-------------+-----------------+-------------- > file | works | TypeError | works > StringIO | works | works | works > cStringIO | works | TypeError | works > socket._fileobject [1]_ | works | works | works > > .. [1] I've only looked at the code and reasoned about this. > > What I'm puzzled about is that the commit message of 66491 mentions > compatibility to StringIO but that would have worked just fine with > `None`. So this either actually means "compatibility with file" or > "compatibility with cStringIO". > > Nevertheless: passing in 0 seems to be the safe bet in general and I > wonder what is actually breaking. I haven't seen a traceback be attached > at either bug. Also, those bugs should probably be marked as duplicates. > You are right, looking at the problem again i suggest to add this change to zope.publisher.xmlrpc - --- src/zope/publisher/xmlrpc.py (revision 100356) +++ src/zope/publisher/xmlrpc.py (working copy) @@ -46,10 +46,14 @@ 'See IPublisherRequest' # Parse the request XML structure - - # XXX using readlines() instead of lines() - - # as twisted's BufferedStream sends back - - # an empty stream here for read() (bug) - - lines = ''.join(self._body_instream.readlines()) + # XXX using readline() instead of readlines() + # as readlines() is not working with + # paster.httpserver + line = 1 + lines = '' + while line != '': + line = self._body_instream.readline() + lines += line self._args, function = xmlrpclib.loads(lines) The fix was proposed by jens Klein, see https://bugs.launchpad.net/zope3/+bug/283089/comments/3 If noone objects i will add it to the zope.publisher 3.4 branch and make a release (3.4.8). The fix is needed at least for Grok to make XMLRPC work with paster.httpserver. Regards Michael - -- http://blog.d2m.at http://planetzope.org -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFKGrR4l0uAvQJUKVYRAh1hAKCJDDSM/MDeuuzOn9jddnZWsfI2IACgnWOi lMnwK3vbJcAYu5miFKXjAH8= =Fxqf -----END PGP SIGNATURE----- _______________________________________________ Zope-Dev maillist - Zope-Dev[at]zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
|