From: Guido van Rossum Date: Mon, 15 Jan 2001 18:31:13 +0000 (+0000) Subject: - Make sure to quote the username and password (SF patch #103236 by X-Git-Tag: v2.1a1~259 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=afc4f0413ae7c307207772373937b0eb1e0a645b;p=python - 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. --- diff --git a/Lib/urllib.py b/Lib/urllib.py index e79acf02d9..cd22766670 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()