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: xmlrpc.client ignores query in URI ("?action=xmlrpc2") since python-3.9
Type: behavior Stage: resolved
Components: XML Versions: Python 3.10, Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: OndrejPtak, Rosuav, corona10, eli.bendersky, kynan, miss-islington, scoder, serhiy.storchaka, vstinner
Priority: normal Keywords: patch

Created on 2021-03-08 12:29 by OndrejPtak, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 25045 closed Rosuav, 2021-03-27 21:46
PR 25057 merged serhiy.storchaka, 2021-03-28 20:52
PR 25068 merged miss-islington, 2021-03-29 13:39
Messages (8)
msg388263 - (view) Author: OndrejPtak (OndrejPtak) Date: 2021-03-08 12:29
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 ?
msg388830 - (view) Author: OndrejPtak (OndrejPtak) Date: 2021-03-16 10:37
Reproducer:
* create ServerProxy with UPI containing query part, e.g. http://example.com?foo=bar
* communicate

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"
msg389621 - (view) Author: Chris Angelico (Rosuav) * Date: 2021-03-27 21:48
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.
msg389678 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2021-03-29 09:33
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.
msg389703 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2021-03-29 13:39
New changeset c1b073a630bb731de18bb17afb2b8b1388b92a72 by Serhiy Storchaka in branch 'master':
bpo-43433: Preserve query and fragment in the URL of the server in ServerProxy. (GH-25057)
https://github.com/python/cpython/commit/c1b073a630bb731de18bb17afb2b8b1388b92a72
msg389705 - (view) Author: miss-islington (miss-islington) Date: 2021-03-29 14:43
New changeset 5334605035d38139a04189ecb3899f36702517b2 by Miss Islington (bot) in branch '3.9':
bpo-43433: Preserve query and fragment in the URL of the server in ServerProxy. (GH-25057)
https://github.com/python/cpython/commit/5334605035d38139a04189ecb3899f36702517b2
msg389730 - (view) Author: frathgeber (kynan) Date: 2021-03-29 19:27
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?
msg389740 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2021-03-29 20:35
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.
History
Date User Action Args
2022-04-11 14:59:42adminsetgithub: 87599
2021-03-29 20:35:34vstinnersetstatus: open -> closed

nosy: + vstinner
messages: + msg389740

resolution: fixed
stage: patch review -> resolved
2021-03-29 19:27:07kynansetmessages: + msg389730
2021-03-29 14:43:10miss-islingtonsetmessages: + msg389705
2021-03-29 13:39:51miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request23818
2021-03-29 13:39:35corona10setnosy: + corona10
messages: + msg389703
2021-03-29 09:33:16serhiy.storchakasetmessages: + msg389678
2021-03-28 20:52:36serhiy.storchakasetpull_requests: + pull_request23804
2021-03-28 14:11:01serhiy.storchakasetassignee: serhiy.storchaka

nosy: + serhiy.storchaka
2021-03-28 09:33:23kynansetnosy: + kynan
2021-03-28 09:28:19serhiy.storchakalinkissue43645 superseder
2021-03-27 21:48:25Rosuavsetnosy: scoder, eli.bendersky, Rosuav, OndrejPtak
messages: + msg389621
versions: + Python 3.10
2021-03-27 21:46:47Rosuavsetkeywords: + patch
nosy: + Rosuav

pull_requests: + pull_request23793
stage: patch review
2021-03-16 10:37:38OndrejPtaksetmessages: + msg388830
2021-03-16 10:26:02torsavasetnosy: + scoder, eli.bendersky
2021-03-16 10:15:11torsavasetcomponents: + XML
2021-03-08 12:29:34OndrejPtaksettitle: xmlrpc.client ignores query in URI ("?action=xmlrpc2") from python-3.9 -> xmlrpc.client ignores query in URI ("?action=xmlrpc2") since python-3.9
2021-03-08 12:29:16OndrejPtakcreate