[New-bugs-announce] [issue43330] xmlrpc.Server URI query and fragment are discarded from HTTP query since py3

Julien Castiaux report at bugs.python.org
Fri Feb 26 12:02:19 EST 2021

New submission from Julien Castiaux <julien.castiaux at gmail.com>:


There is a backward incompatibility between xmlrpc.client and xmlrpclib in server classes about how the URI is parsed and used to connect to the remote server. While py2's xmlrpclib use the path, query and fragment parts of the URI request the server, py3's xmlrpc.client solely uses the path and discard both the query and the fragment parts.

In the ProxyServer init method, py2 xmlrpclib does the following to extract the URI:

    def __init__(self, uri, transport=None, encoding=None, verbose=0,
                 allow_none=0, use_datetime=0, context=None):
        import urllib
        type, uri = urllib.splittype(uri)
        self.__host, self.__handler = urllib.splithost(uri)
        if not self.__handler:
            self.__handler = "/RPC2"

While in ProxyServer init method, py3 xmlrpc.client does the following:

    def __init__(self, uri, transport=None, encoding=None, verbose=False,
                 allow_none=False, use_datetime=False, use_builtin_types=False,
                 *, headers=(), context=None):
        p = urllib.parse.urlparse(uri)
        self.__host = p.netloc
        self.__handler = p.path or "/RPC2"

A Pull Request is coming shortly

components: Library (Lib)
messages: 387730
nosy: Julien Castiaux
priority: normal
severity: normal
status: open
title: xmlrpc.Server URI query and fragment are discarded from HTTP query since py3
type: behavior
versions: Python 3.6

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list