Skip to content

xmlrpc.client ignores query in URI ("?action=xmlrpc2") since python-3.9 #87599

Closed

Description

@optak
mannequin
BPO 43433
Nosy @scoder, @vstinner, @kynan, @Rosuav, @serhiy-storchaka, @corona10, @miss-islington, @optak
PRs
  • bpo-43433: Reattach query parameters after parsing URI #25045
  • bpo-43433: Preserve query and fragment in the URL of the server in ServerProxy. #25057
  • [3.9] bpo-43433: Preserve query and fragment in the URL of the server in ServerProxy. (GH-25057) #25068
  • 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/serhiy-storchaka'
    closed_at = <Date 2021-03-29.20:35:34.832>
    created_at = <Date 2021-03-08.12:29:16.590>
    labels = ['expert-XML', 'type-bug', '3.9', '3.10']
    title = 'xmlrpc.client ignores query in URI ("?action=xmlrpc2") since python-3.9'
    updated_at = <Date 2021-03-29.20:35:34.832>
    user = 'https://github.com/optak'

    bugs.python.org fields:

    activity = <Date 2021-03-29.20:35:34.832>
    actor = 'vstinner'
    assignee = 'serhiy.storchaka'
    closed = True
    closed_date = <Date 2021-03-29.20:35:34.832>
    closer = 'vstinner'
    components = ['XML']
    creation = <Date 2021-03-08.12:29:16.590>
    creator = 'OndrejPtak'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 43433
    keywords = ['patch']
    message_count = 8.0
    messages = ['388263', '388830', '389621', '389678', '389703', '389705', '389730', '389740']
    nosy_count = 9.0
    nosy_names = ['scoder', 'vstinner', 'eli.bendersky', 'kynan', 'Rosuav', 'serhiy.storchaka', 'corona10', 'miss-islington', 'OndrejPtak']
    pr_nums = ['25045', '25057', '25068']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue43433'
    versions = ['Python 3.9', 'Python 3.10']

    Activity

    1. optak commented on Mar 8, 2021

      optakmannequin
      MannequinAuthor

      xmlrpc.client proxy behaviour changed and broke tools depending on URI containing query part.

      Last working version: https://github.com/python/cpython/blob/3.8/Lib/xmlrpc/client.py#L1417

      Changed behaviour here: https://github.com/python/cpython/blob/3.9/Lib/xmlrpc/client.py#L1424

      Is this change intended? If so, what is recommended solution for xmlrpc client communicating with URI: http://example.com/path?var=foo ?

    2. added
      type-bugAn unexpected behavior, bug, or error
      on Mar 8, 2021
    3. changed the title [-]xmlrpc.client ignores query in URI ("?action=xmlrpc2") from python-3.9[/-] [+]xmlrpc.client ignores query in URI ("?action=xmlrpc2") since python-3.9[/+] on Mar 8, 2021
    4. optak commented on Mar 16, 2021

      optakmannequin
      MannequinAuthor

      Reproducer:

      Old behavior:
      -------------
      send: b'POST /?foo=bar HTTP/1.1\r\nHost: example.com\r\nAccept-Encoding: gzip\r\nContent-Type: text/xml\r\nUser-Agent: Python-xmlrpc/3.8\r\nContent-Length: 197\r\n\r\n'
      send: b"<?xml version='1.0'?>\n<methodCall>\n<methodName>getRecentChanges</methodName>\n<params>\n<param>\n<value><dateTime.iso8601>20210301T00:00:00</dateTime.iso8601></value>\n</param>\n</params>\n</methodCall>\n"

      New behaviour:
      --------------
      send: b'POST / HTTP/1.1\r\nHost: example.com\r\nAccept-Encoding: gzip\r\nContent-Type: text/xml\r\nUser-Agent: Python-xmlrpc/3.9\r\nContent-Length: 197\r\n\r\n'
      send: b"<?xml version='1.0'?>\n<methodCall>\n<methodName>getRecentChanges</methodName>\n<params>\n<param>\n<value><dateTime.iso8601>20210301T00:00:00</dateTime.iso8601></value>\n</param>\n</params>\n</methodCall>\n"

    5. Rosuav commented on Mar 27, 2021

      @Rosuav
      Contributor

      Can confirm. This changed in bpo-38038 and the fix isn't too difficult.

      Adding 3.10 in case it's decided that this shouldn't be patched onto 3.9.

    6. serhiy-storchaka commented on Mar 29, 2021

      @serhiy-storchaka
      Member

      Thank you for your reports OndrejPtak and frathgeber.

      Indeed, the behavior change was unintended. PR 25057 tries to to restore the old behavior. Query and fragment are now preserved in the server URL.

      But there are still minor differences. Empty query and fragment are stripped from the URL, so "http://example.org/RPC2?", "http://example.org/RPC2#" and "http://example.org/RPC2" refer to the same connection point. I am not sure that it is important. It would be not easy to preserve the old behavior in these corner cases.

    7. corona10 commented on Mar 29, 2021

      @corona10
      Member

      New changeset c1b073a by Serhiy Storchaka in branch 'master':
      bpo-43433: Preserve query and fragment in the URL of the server in ServerProxy. (GH-25057)
      c1b073a

    8. miss-islington commented on Mar 29, 2021

      @miss-islington
      Contributor

      New changeset 5334605 by Miss Islington (bot) in branch '3.9':
      bpo-43433: Preserve query and fragment in the URL of the server in ServerProxy. (GH-25057)
      5334605

    9. kynan commented on Mar 29, 2021

      kynanmannequin
      Mannequin

      Thanks Serhiy for the very quick fix! I believe handling these corner cases is not worth the effort and I really hope no one relies on these being differentiated. This change will go into a future 3.9 release?

    10. vstinner commented on Mar 29, 2021

      @vstinner
      Member

      It seems like the issue is now fixed. Thanks Serhiy for the fix and thanks OndrejPtak for the report!

      This change will go into a future 3.9 release?

      Yes, sure. Python 3.9 Release Schedule:
      https://www.python.org/dev/peps/pep-0596/

      Next expected release: Python 3.9.3: Monday, 2021-05-03.

    11. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions