summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2001-01-15 18:31:13 (GMT)
committerGuido van Rossum <guido@python.org>2001-01-15 18:31:13 (GMT)
commitafc4f0413ae7c307207772373937b0eb1e0a645b (patch)
tree38e32fd1333b07f676f68bae40f2007ba49588f8
parent2e24044f9db23c3d2195a129f53f2deb73a4e4af (diff)
downloadcpython-afc4f0413ae7c307207772373937b0eb1e0a645b.zip
cpython-afc4f0413ae7c307207772373937b0eb1e0a645b.tar.gz
cpython-afc4f0413ae7c307207772373937b0eb1e0a645b.tar.bz2
- Make sure to quote the username and password (SF patch #103236 by
dogfort). - Don't drop the data argument when calling open_https() from the authentication error handler.
-rw-r--r--Lib/urllib.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/urllib.py b/Lib/urllib.py
index e79acf0..cd22766 100644
--- a/Lib/urllib.py
+++ b/Lib/urllib.py
@@ -563,7 +563,7 @@ class FancyURLopener(URLopener):
host = host[i:]
user, passwd = self.get_user_passwd(host, realm, i)
if not (user or passwd): return None
- host = user + ':' + passwd + '@' + host
+ host = quote(user, safe='') + ':' + quote(passwd, safe='') + '@' + host
newurl = 'http://' + host + selector
if data is None:
return self.open(newurl)
@@ -576,9 +576,9 @@ class FancyURLopener(URLopener):
host = host[i:]
user, passwd = self.get_user_passwd(host, realm, i)
if not (user or passwd): return None
- host = user + ':' + passwd + '@' + host
+ host = quote(user, safe='') + ':' + quote(passwd, safe='') + '@' + host
newurl = '//' + host + selector
- return self.open_https(newurl)
+ return self.open_https(newurl, data)
def get_user_passwd(self, host, realm, clear_cache = 0):
key = realm + '@' + host.lower()