mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Feeble attempt at making urlopen more robust -- don't call splituser()
when splithost() returned no useable host, to avoid calling splituser() on None.
This commit is contained in:
parent
d0ddb66c84
commit
0eae8fba81
1 changed files with 6 additions and 2 deletions
|
@ -214,9 +214,11 @@ class URLopener:
|
|||
# Use HTTP protocol
|
||||
def open_http(self, url, data=None):
|
||||
import httplib
|
||||
user_passwd = None
|
||||
if type(url) is type(""):
|
||||
host, selector = splithost(url)
|
||||
user_passwd, host = splituser(host)
|
||||
if host:
|
||||
user_passwd, host = splituser(host)
|
||||
realhost = host
|
||||
else:
|
||||
host, selector = url
|
||||
|
@ -226,7 +228,9 @@ class URLopener:
|
|||
realhost = None
|
||||
else:
|
||||
realhost, rest = splithost(rest)
|
||||
user_passwd, realhost = splituser(realhost)
|
||||
if realhost:
|
||||
user_passwd, realhost = \
|
||||
splituser(realhost)
|
||||
if user_passwd:
|
||||
selector = "%s://%s%s" % (urltype,
|
||||
realhost,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue