[Zope-Coders] Re: [ZC] 465/ 3 Comment "Possible incorrect XML-RPC bevaviour with
no <params/> tag included in XMLRPC request"
Tim Hoffman
timhoffman@cams.wa.gov.au
10 Jul 2002 18:12:01 +0800
Hi
I mentioned this to Fredrik Lundh at Pythonware and his reply was
>what version of xmlrpclib.py are you using? from what I can
>tell, this was fixed in 1.0b2 (march 2001).
>
>in the fixed version, the end_methodName method sets the
>_type attribute to "methodName" to indicate that we've seen
>a method name, but no params block:
>
> def end_methodName(self, data):
> if self._encoding:
> data = _decode(data, self._encoding)
> self._methodname = data
> self._type = "methodName" # no params
> dispatch["methodName"] = end_methodName
Looking at the stable version 0.9.9 on Pythonware it doesn't have the
changes required. So I would say 0.9.9 doesn't fix it. As it's last
update is prior to March 2001. And has an number of other improvements
made up till the end of last year.
We would need to use the version on effbot.org
http://effbot.org/downloads/
History from that version (1.0b4) has
# History:
# 1999-01-14 fl Created
# 1999-01-15 fl Changed dateTime to use localtime
# 1999-01-16 fl Added Binary/base64 element, default to RPC2 service
# 1999-01-19 fl Fixed array data element (from Skip Montanaro)
# 1999-01-21 fl Fixed dateTime constructor, etc.
# 1999-02-02 fl Added fault handling, handle empty sequences, etc.
# 1999-02-10 fl Fixed problem with empty responses (from Skip
Montanaro)
# 1999-06-20 fl Speed improvements, pluggable parsers/transports
(0.9.8)
# 2000-11-28 fl Changed boolean to check the truth value of its
argument
# 2001-02-24 fl Added encoding/Unicode/SafeTransport patches
# 2001-02-26 fl Added compare support to wrappers (0.9.9/1.0b1)
# 2001-03-28 fl Make sure response tuple is a singleton
# 2001-03-29 fl Don't require empty params element (from Nicholas
Riley)
# 2001-06-10 fl Folded in _xmlrpclib accelerator support (1.0b2)
# 2001-08-20 fl Base xmlrpclib.Error on built-in Exception (from Paul
Prescod)
# 2001-09-03 fl Allow Transport subclass to override getparser
# 2001-09-10 fl Lazy import of urllib, cgi, xmllib (20x import speedup)
# 2001-10-01 fl Remove containers from memo cache when done with them
# 2001-10-01 fl Use faster escape method (80% dumps speedup)
# 2001-10-02 fl More dumps microtuning
# 2001-10-04 fl Make sure import expat gets a parser (from Guido van
Rossum)
# 2001-11-12 fl Use repr() to marshal doubles (from Paul Felix)
so does have the fix in it. Any chance we can get that into Zope 2.6 ?
Thanks for your help
Rgds
Tim
:::
On Wed, 2002-07-10 at 17:24, Collector: Zope Bugs, Features, and Patches
... wrote:
> Issue #465 Update (Comment) "Possible incorrect XML-RPC bevaviour with no <params/> tag included in XMLRPC request"
> Status Pending, Zope/bug+solution medium
> To followup, visit:
> http://collector.zope.org/Zope/465
>
> ==============================================================
> = Comment - Entry #3 by htrd on Jul 10, 2002 5:24 am
>
> Zope 2.6a1 already hax xmlrpclib 0.9.9. does that fix your problem?
>
>
> ________________________________________
> = Comment - Entry #2 by smog on Jul 10, 2002 5:03 am
>
> On further investigation, it appears that this problem with
> xmlrpclib.py has been fixed in later releases, but Zope distribution (at least as of Zope 2.5.1) is still using a very old (ie 1999) release of xmlrpclib.py
>
> Current stable release from pythonware is # History:
> # 1999-01-14 fl Created
> # 1999-01-15 fl Changed dateTime to use localtime
> # 1999-01-16 fl Added Binary/base64 element, default to RPC2 service
> # 1999-01-19 fl Fixed array data element (from Skip Montanaro)
> # 1999-01-21 fl Fixed dateTime constructor, etc.
> # 1999-02-02 fl Added fault handling, handle empty sequences, etc.
> # 1999-02-10 fl Fixed problem with empty responses (from Skip Montanaro)
> # 1999-06-20 fl Speed improvements, pluggable parsers/transports (0.9.8)
> # 2000-11-28 fl Changed boolean to check the truth value of its argument
> # 2001-02-24 fl Added encoding/Unicode/SafeTransport patches
> # 2001-02-26 fl Added compare support to wrappers (0.9.9)
>
> The least update in the Zope xmlrpclib.py was June 1999
>
> Could we get this updated in Zope 2.6?
>
> ________________________________________
> = Request - Entry #1 by smog on Jul 10, 2002 1:59 am
>
> If an XML-RPC request in the form
>
>
>
>
>
> <?xml version="1.0"?>
>
>
> <methodCall>
>
>
> <methodName>title_or_id</methodName>
>
>
> </methodCall>
>
>
>
>
>
> is requested an ResponseError: <xmlrpclib.ResponseError instance at 65123c> is raised.
>
>
>
> but expects and works correctly with
>
> <?xml version="1.0"?>
> <methodCall>
> <methodName>title_or_id</methodName>
> <params></params>
> </methodCall>
>
>
>
> The xmlrpclib.py is written such that
>
>
> an empty <params/> tag must be included if no
>
>
> parameters are passed in the call.
>
>
>
>
>
> However the spec (http://www.xmlrpc.org/spec
>
> )
> say's
>
>
>
> "If
> the procedure call has parameters, the <methodCall> must contain a <params> sub-item. The <params> sub-item can contain any number of <param>s, each of which has a <value>."
>
> My reading of this suggests to me that if there are parameters then you must include <params> tag, if there are no paramteres is doesn't say you must include a empty <params/> tag.
>
> I have found an XML-RPC client - part of XWT (XML window toolkit) www.xwt.org that doesn't include an empty <params/> tag, and theauthors are pretty convinced that the Zope implementation is incorrect (which I am inclined to agree with)
>
> The fix as I understand it would be in
> xmlrpclib.py in the __init__ method line 359
> and change self._type = None to self._type = ()
>
> and in line 368 close method
> change line
>
> if self._type is None or self._marks:
>
> to
>
> if self._marks
>
> I however don't really know what impact this might have to other things (I doubt any)
>
> Alternately if it is believed that the implementation is correct in xmlrpclib.py then the specification on xmlrpc.com should get changed to be clearer on this point.
>
>
>
> ==============================================================
>