python / cpython

The Python programming language
https://www.python.org
Other
62.15k stars 29.87k forks source link

[xmlrpc.client.ServerProxy] It does not correctly parse the URL with basic authentication. #82035

Open 362e3855-9b79-4447-a30b-d4f156529f27 opened 5 years ago

362e3855-9b79-4447-a30b-d4f156529f27 commented 5 years ago
BPO 37854
Nosy @CuriousLearner, @f9n

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: ```python assignee = None closed_at = None created_at = labels = ['3.8', '3.7', 'library', '3.9'] title = '[xmlrpc.client.ServerProxy] It does not correctly parse the URL with basic authentication.' updated_at = user = 'https://github.com/f9n' ``` bugs.python.org fields: ```python activity = actor = 'CuriousLearner' assignee = 'none' closed = False closed_date = None closer = None components = ['Library (Lib)'] creation = creator = 'f9n' dependencies = [] files = [] hgrepos = [] issue_num = 37854 keywords = [] message_count = 3.0 messages = ['349726', '349728', '349730'] nosy_count = 2.0 nosy_names = ['CuriousLearner', 'f9n'] pr_nums = [] priority = 'normal' resolution = None stage = None status = 'open' superseder = None type = None url = 'https://bugs.python.org/issue37854' versions = ['Python 3.7', 'Python 3.8', 'Python 3.9'] ```

362e3855-9b79-4447-a30b-d4f156529f27 commented 5 years ago

Same problem here. (https://bugs.python.org/issue37853)

362e3855-9b79-4447-a30b-d4f156529f27 commented 5 years ago

I just changed things and it works. But it's not right. It must be better way.(The 'urllib.parse.urlparse' function's bug should be fixed. )

https://github.com/f9n/cpython/tree/fix-issue-37854

CuriousLearner commented 5 years ago

Closed bpo-37853 as a duplicate.

Adding Fatih's comment from there for urllib.parse.urlparse

-------------------------------------------------------------

No problem for these: "http://localhost:9100" "http://user:password@localhost:9100"

But, these are problematic: "http://use#r:password@localhost:9100" "http://user:pass#word@localhost:9100"

from urllib.parse import urlparse

url = "http://us#er:123@localhost:9001/RPC2"
u = urlparse(url)
print(u)
# ParseResult(scheme='http', netloc='us', path='', params='', query='', fragment='er:123@localhost:9001/RPC2')

--------------------------------------