Python SSL Socket issue

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • lauras

    Python SSL Socket issue

    Hello,

    We are having an issue with Python SSL sockets using Apache and mod_python.

    When we try to get an SSL connection using the following code:

    con = httplib.HTTPSCo nnection( self.HOST, self.PORT )
    #con.set_debugl evel(10)
    con.putrequest( "POST", "" )
    con.putheader( "Content-Type", "text/xml" )
    con.putheader( "content-length", int(len(cmd)) )
    con.endheaders( )
    con.send( cmd )

    We get the following error:

    con.endheaders( )
    File "/usr/lib/python2.3/httplib.py", line 715, in endheaders
    self._send_outp ut()
    File "/usr/lib/python2.3/httplib.py", line 600, in _send_output
    self.send(msg)
    File "/usr/lib/python2.3/httplib.py", line 567, in send
    self.connect()
    File "/usr/lib/python2.3/httplib.py", line 988, in connect
    ssl = socket.ssl(sock , self.key_file, self.cert_file)
    File "/usr/lib/python2.3/socket.py", line 73, in ssl
    return _realssl(sock, keyfile, certfile)
    TypeError: ssl() argument 1 must be _socket.socket, not _socketobject


    Has anyone encountered this before or has any suggestions?

    Thanks,
    Laura
  • adam

    #2
    Re: Python SSL Socket issue

    Try

    con.connect()

    before the first putrequest

    -adam

    Comment

    Working...