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: urlunparse does not escape slash (/) for http+unix:// in netloc field
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.9, Python 3.8, Python 3.7, Python 3.6, Python 3.5
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Ido Michael, socketpair, taleinat
Priority: normal Keywords:

Created on 2020-04-23 11:12 by socketpair, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (3)
msg367092 - (view) Author: Марк Коренберг (socketpair) * Date: 2020-04-23 11:12
urlunsplit(('http+unix', '\x00qwe/asd', 'def', '', ''))                                                                       

gives:

'http+unix://\x00qwe/asd/def'

but should:

'http+unix://\x00qwe%2Fasd/def'

see https://github.com/msabramo/requests-unixsocket for examples of such URLs.

Workaround: build URL by hand, like `f'http+unix://{quote(..., safe='')}/....'`
msg369842 - (view) Author: Ido Michael (Ido Michael) * Date: 2020-05-24 23:02
Did you try using the urllib.urlencode() function? 
Also it's not clear to me what happens if you give the expected string to urlunsplit() ? I believe it will keep the format as is, str or URL encoded.

Tal what do you think?
msg369856 - (view) Author: Tal Einat (taleinat) * (Python committer) Date: 2020-05-25 07:39
This seems to simply be a misunderstanding: urlunparse() and urlunsplit() intentionally do not do any encoding of their components.
History
Date User Action Args
2022-04-11 14:59:29adminsetgithub: 84553
2020-05-25 07:39:29taleinatsetstatus: open -> closed
resolution: not a bug
messages: + msg369856

stage: resolved
2020-05-24 23:03:45Ido Michaelsetnosy: + taleinat
2020-05-24 23:02:01Ido Michaelsetnosy: + Ido Michael
messages: + msg369842
2020-04-23 11:12:54socketpaircreate