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: Add scgi to urllib.parse.uses_netloc
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.4, Python 2.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: anthonyryan1, martin.panter, orsenthil
Priority: normal Keywords:

Created on 2015-03-11 00:49 by anthonyryan1, last changed 2022-04-11 14:58 by admin.

Files
File name Uploaded Description Edit
py3bug anthonyryan1, 2015-03-11 00:49 Simple testcase demonstrating problem
py2bug anthonyryan1, 2015-03-11 00:50 Simple testcase demonstrating problem
Messages (2)
msg237831 - (view) Author: Anthony Ryan (anthonyryan1) Date: 2015-03-11 00:49
The scgi protocol is not included in urllib.parse.uses_netloc list, while other less common protocols are (such as gopher).

I would like to see scgi get added to this list.
msg237837 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2015-03-11 02:12
See also Issue 16134 for adding RTMP schemes to the registry. However, I wonder if it is time for a more general fix, rather than having an arms race with whatever URL scheme someone dreams up next.

According to Issue 7904, urlsplit() etc intentially support parsing the //netloc part for arbitrary URL schemes. However when putting it back together, the urlunsplit() etc functions currently cannot assume it is okay to insert an empty netloc “//”, probably because it would break URLs like tel:+1234 or mailto:somebody@example.net.

There are a bunch of URL-parsing issues floating around which may be able to come together to solve each other:

* Issue 8339: Round trip stripping empty netloc, apparently closed because the URLs were thought to be invalid (thought I disagree)
* Issue 15009: Round trip strips empty netloc for yelp:///foo
* Issue 23505: Round trip stripping netloc considered a security issue
* Issue 5843: Round trip stripping empty query and fragment strings
* Issue 22852: Round trip strips empty fragment

In Issue 22852, I proposed adding a series of has_netloc/query/fragment flags to the SplitResult etc classes. If that was implemented, we would not have to worry about whitelisting “scgi:” or other schemes in “uses_netloc”. Instead, urlsplit() would automatically set SplitResult(has_netloc=True), and urlunsplit() would know to restore the empty “//” netloc string.
History
Date User Action Args
2022-04-11 14:58:13adminsetgithub: 67824
2015-03-11 04:16:12ned.deilysetnosy: + orsenthil
2015-03-11 02:12:44martin.pantersetnosy: + martin.panter
messages: + msg237837
2015-03-11 00:50:18anthonyryan1setfiles: + py2bug
2015-03-11 00:49:52anthonyryan1create