diff options
-rw-r--r-- | src/lib/SSLServer.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/lib/SSLServer.py b/src/lib/SSLServer.py index bb0f61198..d5d2f2b3a 100644 --- a/src/lib/SSLServer.py +++ b/src/lib/SSLServer.py @@ -195,13 +195,17 @@ class XMLRPCRequestHandler (SimpleXMLRPCServer.SimpleXMLRPCRequestHandler): self.logger.error("No authentication data presented") return False auth_type, auth_content = header.split() - auth_content = base64.standard_b64decode(bytes(auth_content.encode('ascii'))) + try: + # py3k compatibility + auth_content = base64.standard_b64decode(auth_content) + except TypeError: + auth_content = base64.standard_b64decode(bytes(auth_content.encode('ascii'))) try: # py3k compatibility try: username, password = auth_content.split(":") except TypeError: - username, pw = auth_content.split(b":") + username, pw = auth_content.split(bytes(":", encoding='utf-8')) password = pw.decode('utf-8') except ValueError: username = auth_content |