Describe the bug
user and password casing is preserved when using the constructor:
>>> yarl.URL('httPS://usER:passWORD@hostNAME/paTH')
URL('https://usER:passWORD@hostname/paTH')
>>> yarl.URL('httPS://usER:passWORD@hostNAME/paTH').user
'usER'
user and password casing is lost when using URL.build:
>>> yarl.URL.build(scheme='httPS', host='usER:passWORD@hostNAME', path='/paTH')
URL('httPS://user:password@hostname/paTH')
>>> yarl.URL.build(scheme='httPS', host='usER:passWORD@hostNAME', path='/paTH').user
'user'
Note that the user & password are extracted from the string passed as host.
passing user and password explicitly also preserves the casing:
>>> yarl.URL.build(scheme='httPS', user='usER', password='passWORD', host='hostNAME', path='/paTH')
URL('httPS://usER:passWORD@hostname/paTH')
>>> yarl.URL.build(scheme='httPS', user='usER', password='passWORD', host='hostNAME', path='/paTH').user
'usER'
I'd expect either user and password to preserve casing when passed into host (preferably) or them not being extracted into the user and password attributes and instead remain in the lowercase and encoded host attribute.
maybe caused by #386
converting the host to lowercase should be done after extracting username / password.
To Reproduce
>>> yarl.URL.build(scheme='httPS', host='usER:passWORD@hostNAME', path='/paTH')
URL('httPS://user:password@hostname/paTH')
>>> yarl.URL.build(scheme='httPS', host='usER:passWORD@hostNAME', path='/paTH').user
'user'
Expected behavior
>>> yarl.URL.build(scheme='httPS', host='usER:passWORD@hostNAME', path='/paTH')
URL('httPS://user:password@hostname/paTH')
>>> yarl.URL.build(scheme='httPS', host='usER:passWORD@hostNAME', path='/paTH').user
'usER'
Logs/tracebacks
Python Version
$ python --version
Python 3.10.10
multidict Version
$ python -m pip show multidict
Name: multidict
Version: 6.0.4
Summary: multidict implementation
Home-page: https://github.com/aio-libs/multidict
Author: Andrew Svetlov
Author-email: [email protected]
License: Apache 2
Location: /usr/lib/python3.10/site-packages
Requires:
Required-by: aiohttp, httpie, yarl
yarl Version
$ python -m pip show yarl
Name: yarl
Version: 1.8.2
Summary: Yet another URL library
Home-page: https://github.com/aio-libs/yarl/
Author: Andrew Svetlov
Author-email: [email protected]
License: Apache 2
Location: /home/stefan/.local/lib/python3.10/site-packages
Requires: idna, multidict
Required-by: aiohttp
OS
Arch Linux
Additional context
No response
Code of Conduct
Describe the bug
user and password casing is preserved when using the constructor:
user and password casing is lost when using
URL.build:Note that the user & password are extracted from the string passed as
host.passing user and password explicitly also preserves the casing:
I'd expect either user and password to preserve casing when passed into
host(preferably) or them not being extracted into theuserandpasswordattributes and instead remain in the lowercase and encodedhostattribute.maybe caused by #386
converting the host to lowercase should be done after extracting username / password.
To Reproduce
Expected behavior
Logs/tracebacks
Python Version
multidict Version
yarl Version
OS
Arch Linux
Additional context
No response
Code of Conduct