Python THttpClient fails with https sites
-----------------------------------------
Key: THRIFT-154
URL: https://issues.apache.org/jira/browse/THRIFT-154
Project: Thrift
Issue Type: Bug
Components: Library (Python)
Reporter: Dave Engberg
Attachments: THttpClient.py.diff
THttpClient contains a hard-coded reference to httplib.HTTP() which prevents it
from working with any SSL sites.
Here's a small patch that will at least use SSL when the port is 443. I'm not
much of a Python expert, but I think (based on the current docs for the
'httplib' module) that a better solution would be to rewrite the THttpClient to
take a URL instead of host+port+uri and then use the urllib module instead of
the lower-level httplib, but this little patch will at least allow basic
interoperability against HTTPS.
Index: lib/py/src/transport/THttpClient.py
===================================================================
--- lib/py/src/transport/THttpClient.py (revision 701711)
+++ lib/py/src/transport/THttpClient.py (working copy)
@@ -21,7 +21,10 @@
self.__http = None
def open(self):
- self.__http = httplib.HTTP(self.host, self.port)
+ if self.port == httplib.HTTPS_PORT:
+ self.__http = httplib.HTTPS(self.host, self.port)
+ else:
+ self.__http = httplib.HTTP(self.host, self.port)
def close(self):
self.__http.close()
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.