Martin Panter added the comment:

## Inferring flags ##

The whole reason for the has_netloc etc flags is that I don’t think we can 
always infer their values, so we have to explicitly remember them. Consider the 
following two URLs, which I think should both have empty “netloc” strings for 
backwards compatibility, but should be handled differently by urlunsplit():

>>> urlsplit("////evil.com").netloc
''
>>> urlsplit("////evil.com").has_netloc
True
>>> urlunsplit(urlsplit("////evil.com"))  # Adds “//” back
'////evil.com'
>>> urlsplit("/normal/path").netloc
''
>>> urlsplit("/normal/path").has_netloc
False
>>> urlunsplit(urlsplit("/normal/path"))  # Does not add “//”
'/normal/path'

## _NetlocResultMixinBase abuse ##

The _NetlocResultMixinBase class is a common class used by the four result 
classes I’m interested in. I probably should rename it to something like 
_SplitParseMixinBase, since it is the common base to both urlsplit() and 
urlparse() results.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue22852>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to