All,

It's been my observation that this code:

class MyProto(protocol.Protocol):

   def connectionMade(self):
     print self.transport.getPeerCertificate()
     self.transport.loseConnection()

class MyFactory(protocol.ClientFactory):

   def buildProtocol(self, addr):
     return MyProto()

def main():
   factory = MyFactory()
   ctxfact = ssl.ClientContextFactory()
   reactor.connectSSL(host, port, factory, ctxfact)
   reactor.run()

...will print "None". It seems that connectSSL calls connectionMade at 
TCP connection time, not when SSL has completed. This seems unintuitive 
to me because I've called "connectSSL" not "connectTCP", but I guess may 
be hard to fix given the way the code works?

At the very least, should this be documented?

Or could we have an interface e.g.

class ISSLProtocol(interface):
   def sslReady():
     """called when the SSL layer is ready"""

...and people who are interested can "implements()" it to get the callback?

_______________________________________________
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

Reply via email to