Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xmlrpclib.Binary doesn't say which base64 spec it implements #45195

Closed
slinkp mannequin opened this issue Jul 13, 2007 · 7 comments
Closed

xmlrpclib.Binary doesn't say which base64 spec it implements #45195

slinkp mannequin opened this issue Jul 13, 2007 · 7 comments
Assignees
Labels
docs Documentation in the Doc dir easy

Comments

@slinkp
Copy link
Mannequin

slinkp mannequin commented Jul 13, 2007

BPO 1753732
Nosy @loewis, @smontanaro
Files
  • libxmlrpclib.patch: Patch against Doc/lib/libxmlrpclib.tex from trunk
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/smontanaro'
    closed_at = <Date 2008-04-23.14:36:08.617>
    created_at = <Date 2007-07-13.18:36:56.000>
    labels = ['easy', 'docs']
    title = "xmlrpclib.Binary doesn't say which base64 spec it implements"
    updated_at = <Date 2008-04-23.14:36:08.616>
    user = 'https://bugs.python.org/slinkp'

    bugs.python.org fields:

    activity = <Date 2008-04-23.14:36:08.616>
    actor = 'benjamin.peterson'
    assignee = 'skip.montanaro'
    closed = True
    closed_date = <Date 2008-04-23.14:36:08.617>
    closer = 'benjamin.peterson'
    components = ['Documentation']
    creation = <Date 2007-07-13.18:36:56.000>
    creator = 'slinkp'
    dependencies = []
    files = ['2420']
    hgrepos = []
    issue_num = 1753732
    keywords = ['patch', 'easy']
    message_count = 7.0
    messages = ['32500', '32501', '32502', '32503', '32504', '65693', '65699']
    nosy_count = 3.0
    nosy_names = ['loewis', 'skip.montanaro', 'slinkp']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue1753732'
    versions = []

    @slinkp
    Copy link
    Mannequin Author

    slinkp mannequin commented Jul 13, 2007

    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 :)

    @slinkp slinkp mannequin added docs Documentation in the Doc dir labels Jul 13, 2007
    @loewis
    Copy link
    Mannequin

    loewis mannequin commented Jul 14, 2007

    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.

    @slinkp
    Copy link
    Mannequin Author

    slinkp mannequin commented Jul 16, 2007

    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

    @loewis
    Copy link
    Mannequin

    loewis mannequin commented Jul 16, 2007

    More documentation is always a good idea. Can you provide a patch (as a context or unified patch) against the sources of the documentation?

    @slinkp
    Copy link
    Mannequin Author

    slinkp mannequin commented Jul 27, 2007

    Sure. Patch against Doc/lib trunk attached.
    File Added: libxmlrpclib.patch

    @smontanaro
    Copy link
    Contributor

    I updated xmlrpclib.rst with your documentation changes (r62465).
    Is it okay to close this ticket?

    Skip

    @slinkp
    Copy link
    Mannequin Author

    slinkp mannequin commented Apr 23, 2008

    looks good to me, thanks!

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    docs Documentation in the Doc dir easy
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants