mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Patches to make the proxy code work again. (Why does that always break
as soon as I change things even just a little bit? :-) Even works when accessing a password-protected page through the proxy. Prompted by complaints from, and correct operation verified by, Nigel O'Brian.
This commit is contained in:
parent
a986bb7e5c
commit
e0c0da98d8
1 changed files with 3 additions and 2 deletions
|
@ -223,6 +223,7 @@ class URLopener:
|
||||||
else:
|
else:
|
||||||
host, selector = url
|
host, selector = url
|
||||||
urltype, rest = splittype(selector)
|
urltype, rest = splittype(selector)
|
||||||
|
url = rest
|
||||||
user_passwd = None
|
user_passwd = None
|
||||||
if string.lower(urltype) != 'http':
|
if string.lower(urltype) != 'http':
|
||||||
realhost = None
|
realhost = None
|
||||||
|
@ -459,8 +460,8 @@ class FancyURLopener(URLopener):
|
||||||
user, passwd = self.get_user_passwd(host, realm, i)
|
user, passwd = self.get_user_passwd(host, realm, i)
|
||||||
if not (user or passwd): return None
|
if not (user or passwd): return None
|
||||||
host = user + ':' + passwd + '@' + host
|
host = user + ':' + passwd + '@' + host
|
||||||
newurl = '//' + host + selector
|
newurl = 'http://' + host + selector
|
||||||
return self.open_http(newurl)
|
return self.open(newurl)
|
||||||
|
|
||||||
def get_user_passwd(self, host, realm, clear_cache = 0):
|
def get_user_passwd(self, host, realm, clear_cache = 0):
|
||||||
key = realm + '@' + string.lower(host)
|
key = realm + '@' + string.lower(host)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue