Commit c8dcfb6c authored by Georg Brandl's avatar Georg Brandl

part of #3613: fix get_host_info() usage of base64.encodestring().

parent 35e2c4e6
...@@ -135,6 +135,14 @@ class XMLRPCTestCase(unittest.TestCase): ...@@ -135,6 +135,14 @@ class XMLRPCTestCase(unittest.TestCase):
xmlrpclib.loads(strg)[0][0]) xmlrpclib.loads(strg)[0][0])
self.assertRaises(TypeError, xmlrpclib.dumps, (arg1,)) self.assertRaises(TypeError, xmlrpclib.dumps, (arg1,))
def test_get_host_info(self):
# see bug #3613, this raised a TypeError
transp = xmlrpc.client.Transport()
self.assertEquals(transp.get_host_info("user@host.tld"),
('host.tld',
[('Authorization', 'Basic dXNlcg==')], {}))
class HelperTestCase(unittest.TestCase): class HelperTestCase(unittest.TestCase):
def test_escape(self): def test_escape(self):
self.assertEqual(xmlrpclib.escape("a&b"), "a&b") self.assertEqual(xmlrpclib.escape("a&b"), "a&b")
......
...@@ -1161,7 +1161,8 @@ class Transport: ...@@ -1161,7 +1161,8 @@ class Transport:
if auth: if auth:
import base64 import base64
auth = base64.encodestring(urllib.parse.unquote(auth)) auth = urllib.parse.unquote_to_bytes(auth)
auth = base64.encodestring(auth).decode("utf-8")
auth = "".join(auth.split()) # get rid of whitespace auth = "".join(auth.split()) # get rid of whitespace
extra_headers = [ extra_headers = [
("Authorization", "Basic " + auth) ("Authorization", "Basic " + auth)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment