[ https://issues.apache.org/jira/browse/THRIFT-154?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12637772#action_12637772 ]
David Reiss commented on THRIFT-154: ------------------------------------ It makes me a little nervous to have two such completely different semantics in a language without static typing, but it seems like a move in the right direction, so I'll second it. I've made a few small additions to it. What do you guys think? http://gitweb.thrift-rpc.org/?p=thrift.git;a=log;h=refs/heads/pri/dreiss/t154;hb=HEAD > 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: thrift-py-http-uri.patch, 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.