This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: xmlrpclib.Binary doesn't say which base64 spec it implements
Type: Stage:
Components: Documentation Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: skip.montanaro Nosy List: loewis, skip.montanaro, slinkp
Priority: normal Keywords: easy, patch

Created on 2007-07-13 18:36 by slinkp, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
libxmlrpclib.patch slinkp, 2007-07-27 04:12 Patch against Doc/lib/libxmlrpclib.tex from trunk
Messages (7)
msg32500 - (view) Author: Paul Winkler (slinkp) * Date: 2007-07-13 18:36
xmlrpclib.Binary.encode() does base64 encoding.
But there are actually two conflicting specs: RFC 2045 says add newlines every 76 characters, RFC 3548 says do NOT add newlines.

The xmlrpc spec characteristically doesn't mention an RFC, so it's not clear which spec they mean by "base64".
By looking at the dates on the various specs, it can be inferred that they must mean MIME-style with newlines, as per RFC 2045.  That's xmlrpclib does.

But for those of us implementing stuff in the trenches and struggling with interoperability issues, it would be nice if the python docs were more informative so we don't have to go spiraling off into reading multiple specs and figuring out which came first :)

So I'd suggest changing the Binary.encode docstring to something like:

"""Write the XML-RPC base 64 encoding of this binary item to the out stream object.

Note that the encoded data will have newlines every 76 characters as per RFC 2045, which was the de facto standard base64 specification when the xmlrpc spec was written."""

Arguably, the behavior could be changed instead - due to the xmlrpc spec's silence on the subject, not all clients may tolerate newlines (Redstone doesn't)... but that's a separate argument :)
msg32501 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2007-07-14 12:51
Note that RFC 3548 is informational, so it is not a specification (at least not of an internet protocol).

Also notice that Python's xmlrpclib library is not the specification or de-facto implementation of XML-RPC, either. The official XML-RPC specification is at

http://www.xmlrpc.com/spec

According to that specification, the only possibilities are that Python's implementation is either conforming or not conforming. If it is not conforming, it should be changed; if it is conforming, it should stay, and Redstone should be changed.
msg32502 - (view) Author: Paul Winkler (slinkp) * Date: 2007-07-16 15:36
Thanks Loewis, but I am well aware of the xmlrpc spec. As I said in my original bug report:
The spec alone is too vague to tell us which base64 specification xmlrpclib should conform *to*, and thus we can't say whether xmlrpclib does or does not conform. Your yes/no question is thus unanswerable.  In my opinion this means the spec is broken, but there's apparently no chance of an official update.

I brought this up on the xmlrpc yahoo list. 
http://tech.groups.yahoo.com/group/xml-rpc/message/6650

Some excerpts from relevant responses:
"The fact is, the spec has been frozen - "cast in stone" in the words of
the author - since 1999, and there is absolutely 0% chance of an
official update." - http://tech.groups.yahoo.com/group/xml-rpc/message/6651

"It would be nice to have a document that describes what "everyone does,"
but ... http://effbot.org/zone/xmlrpc-errata.htm
does a good job too. Note that the latter clearly says you can split
base64 lines if you want. ... I believe that essentially all XML-RPC implementations use MIME-style
(RFC 2045) base64 encoding -- i.e. with line breaks." - http://tech.groups.yahoo.com/group/xml-rpc/message/6653

Finally, about the Redstone problem that led me to post this report:
"I have just looked at the Redstone Bas64 decoder and it's obviously
broken. The code correctly ignores whitespace characters but then
complains that the data is too short."

I have filed a bug report against Redstone:
http://sourceforge.net/tracker/index.php?func=detail&aid=1753822&group_id=25164&atid=383547

From the responses so far, I don't think a change to Python's behavior is warranted.
I *do* still think it would be useful to clarify the xmlrpclib documentation as I've suggested in this bug report, so users know what to expect. Is there any good reason NOT to do this?

A link to the official spec at http://www.xmlrpc.com/spec should also be added to the "See also" links, possibly along with a link to Fred's unofficial errata at 
http://effbot.org/zone/xmlrpc-errata.htm
msg32503 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2007-07-16 21:08
More documentation is always a good idea. Can you provide a patch (as a context or unified patch) against the sources of the documentation?
msg32504 - (view) Author: Paul Winkler (slinkp) * Date: 2007-07-27 04:12
Sure. Patch against Doc/lib trunk attached.
File Added: libxmlrpclib.patch
msg65693 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2008-04-22 22:46
I updated xmlrpclib.rst with your documentation changes (r62465).
Is it okay to close this ticket?

Skip
msg65699 - (view) Author: Paul Winkler (slinkp) * Date: 2008-04-23 14:13
looks good to me, thanks!
History
Date User Action Args
2022-04-11 14:56:25adminsetgithub: 45195
2008-04-23 14:36:08benjamin.petersonsetstatus: open -> closed
resolution: fixed
2008-04-23 14:13:23slinkpsetmessages: + msg65699
2008-04-22 22:46:17skip.montanarosetassignee: skip.montanaro
messages: + msg65693
nosy: + skip.montanaro
2008-01-21 13:53:37akuchlingsetkeywords: + patch, easy
2007-07-13 18:36:56slinkpcreate