summaryrefslogtreecommitdiffstats
path: root/Lib/urllib2.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-08-03 19:19:24 (GMT)
committerGuido van Rossum <guido@python.org>2007-08-03 19:19:24 (GMT)
commitc0f2d2d345d5fe97f81554d49b273b3feb0e37ae (patch)
treef1e57383a03f8723af8ad68dc831732ad9000dbb /Lib/urllib2.py
parent15863ea07ab4eed2d91ce55b274245e8d420723d (diff)
downloadcpython-c0f2d2d345d5fe97f81554d49b273b3feb0e37ae.zip
cpython-c0f2d2d345d5fe97f81554d49b273b3feb0e37ae.tar.gz
cpython-c0f2d2d345d5fe97f81554d49b273b3feb0e37ae.tar.bz2
SF patch# 1762940 by Joe Gregorio.
Fix test_cookielib and test_urllib2. (The changes to urllib make urllib.quote() work correctly for Unicode strings; but they don't fix test_urllib.)
Diffstat (limited to 'Lib/urllib2.py')
-rw-r--r--Lib/urllib2.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/urllib2.py b/Lib/urllib2.py
index 9c773fc..c8bfe38 100644
--- a/Lib/urllib2.py
+++ b/Lib/urllib2.py
@@ -679,7 +679,7 @@ class ProxyHandler(BaseHandler):
proxy_type = orig_type
if user and password:
user_pass = '%s:%s' % (unquote(user), unquote(password))
- creds = base64.b64encode(user_pass).strip()
+ creds = str(base64.b64encode(user_pass)).strip()
req.add_header('Proxy-authorization', 'Basic ' + creds)
hostport = unquote(hostport)
req.set_proxy(hostport, proxy_type)
@@ -802,7 +802,7 @@ class AbstractBasicAuthHandler:
user, pw = self.passwd.find_user_password(realm, host)
if pw is not None:
raw = "%s:%s" % (user, pw)
- auth = 'Basic %s' % base64.b64encode(raw).strip()
+ auth = 'Basic %s' % str(base64.b64encode(raw)).strip()
if req.headers.get(self.auth_header, None) == auth:
return None
req.add_header(self.auth_header, auth)