[issue2776] urllib2.urlopen() gets confused with path with // in it
Martin McNickle
report at bugs.python.org
Wed May 7 01:22:12 CEST 2008
Martin McNickle <mmcnickle at gmail.com> added the comment:
The problem lines are in AbstractHTTPHandler.do_request():
scheme, sel = splittype(request.get_selector())
sel_host, sel_path = splithost(sel)
if not request.has_header('Host'):
request.add_unredirected_header('Host', sel_host or host)
When there is a double '/' sel is something like '//path/to/resource'.
splithost(sel) then gives ('path', '/to/resource'). Therefore the
header 'Host' gets set to 'path'.
I don't understand why sel_host is used in preference for host. host
holds the correct value, even with the double slashes. Could someone
explain why sel_host is used at all?
----------
nosy: +BitTorment
__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue2776>
__________________________________
More information about the Python-bugs-list
mailing list