[Zope-dev] XML-RPC does not work under the paster process

Michael Haubenwallner michael at d2m.at
Tue May 26 03:05:30 EDT 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Christian Theune wrote:
> On Mon, 2009-05-25 at 17:08 +0200, Michael Haubenwallner wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Christian Theune wrote:
>>> [...]
>>>
>>> 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
> 
> Uhhhm. Why are we changing this? IMHO passing 0 should work and I don't
> see what the actual breakage is.
> 

There is another bugfix related to paster.httpserver in zope.publisher
3.5.3 (2008-06-20)

Bugs fixed:

    * It turns out that some Web servers (Paste for example) do not send
the EOF character after the data has been transmitted and the read() of
the cached stream simply hangs if no expected content length has been
specified.

Could be the same reason as with 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)
> 
> I'm fine with the patch. I just don't understand why we need it. :/
> 
> Here's a small readability suggestion:
> 
> lines = ''
> while True:
>     line = self._body_instream.readline()
>     if not line:
>         break
>     lines += line
> 
> I think assigning assigning an unused value can lead to confusions and
> the head-controlled loop obfuscates whats actually going on.
> 

Thanks for your suggestion, will use it.

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

iD8DBQFKG5S6l0uAvQJUKVYRAlajAJ4+TXIVNtFBzwN5F253rqfc2wqH0QCeJvCq
CMumYwCnLWCeCKNocCmkbp0=
=X7uK
-----END PGP SIGNATURE-----



More information about the Zope-Dev mailing list