Fix bug in Python's THttpClient proxy handling
Client: py
Patch: Peter Schmidbauer
This closes #2565
Fix conversion to str without including quotes
Ensure return type is str in Py2 and 3
In Python2, str(cr) returns a cr unchanged, since it is already a str. In Python3, 'cr' is a binary array (like str in Python2), but we cannot concat a str with a bin in Py3. Therefore, we convert it to str using str(cr), before concatenating it with 'Basic '.
Fix bug in THttpClient proxy handling
diff --git a/lib/py/src/transport/THttpClient.py b/lib/py/src/transport/THttpClient.py
index 1dd1476..6281165 100644
--- a/lib/py/src/transport/THttpClient.py
+++ b/lib/py/src/transport/THttpClient.py
@@ -102,7 +102,7 @@
ap = "%s:%s" % (urllib.parse.unquote(proxy.username),
urllib.parse.unquote(proxy.password))
cr = base64.b64encode(ap.encode()).strip()
- return "Basic " + cr
+ return "Basic " + six.ensure_str(cr)
def using_proxy(self):
return self.realhost is not None