New submission from Martin Panter:
This isn’t a particularly important problem for me but when reading the code I
noticed some bit rot in this function, where a host name in a “file:” URL would
be handled differently than intended.
* The url[:2] == '//' check is probably wrong because it is comparing the URL’s
path component (selector), not the prefix for a host name. Compare
urlopen("file://host//") and urlopen("file://host/") error messages.
* The req.host is self.get_names() should probably use “in”, not “is”. The code
author presumably expected urlopen("file://127.0.0.1//dev/null") to work.
* Also it seems odd that urlopen("file://remote/missing") immediately reports
“No such file”, while urlopen("file://remote/") blocks for a host name lookup
and then reports “not on local host”.
----------
components: Library (Lib)
messages: 222901
nosy: vadmium
priority: normal
severity: normal
status: open
title: Broken code for handling file://host in
urllib.request.FileHandler.file_open
versions: Python 3.4
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue21970>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com