Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-1549

Python TSSLSocket: Shutdown cleanly

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 0.8
    • 0.13.0
    • Python - Library
    • None
    • Patch Available

    Description

      When attempting to use Thrift over SSL, from a Python client to a C++ server, I noticed in the server logs:

      Thrift: Thu Mar 29 18:45:02 2012 SSL_shutdown: error code: 0
      

      This seems to be caused by unclean shutdown by the Python client library where TSocket just closes its socket, and is fixed by the following patch (against Thrift 0.8):

      diff --git a/TSSLSocket.py~ b/TSSLSocket.py
      index 15095d3..3e3fd2d 100644
      --- a/TSSLSocket.py~
      +++ b/TSSLSocket.py
      @@ -88,6 +88,10 @@ class TSSLSocket(TSocket.TSocket):
           if self.validate:
             self._validate_cert()
       
      +  def close(self):
      +    self.handle = self.handle.unwrap()
      +    TSocket.TSocket.close(self)
      +
         def _validate_cert(self):
           """internal method to validate the peer's SSL certificate, and to check the
           commonName of the certificate to ensure it matches the hostname we
      

      If needed, ping me, I will do a rebase to HEAD.

      Attachments

        Issue Links

          Activity

            People

              jking3 James E. King III
              yurikhan Yuri Khan
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m