summaryrefslogtreecommitdiffstats
path: root/Lib/CGIHTTPServer.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/CGIHTTPServer.py')
-rw-r--r--Lib/CGIHTTPServer.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/CGIHTTPServer.py b/Lib/CGIHTTPServer.py
index 828b092..29d701a 100644
--- a/Lib/CGIHTTPServer.py
+++ b/Lib/CGIHTTPServer.py
@@ -182,8 +182,10 @@ class CGIHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
env['AUTH_TYPE'] = authorization[0]
if authorization[0].lower() == "basic":
try:
- authorization = base64.decodestring(authorization[1])
- except binascii.Error:
+ authorization = authorization[1].encode('ascii')
+ authorization = base64.decodestring(authorization).\
+ decode('ascii')
+ except (binascii.Error, UnicodeError):
pass
else:
authorization = authorization.split(':')