[Twisted-Python] reactor.connectSSL() error handling

glyph at divmod.com glyph at divmod.com
Mon May 29 01:37:30 EDT 2006



On Sun, 28 May 2006 21:02:07 +0200, Lorenzo Allegrucci <l.allegrucci at gmail.com> wrote:
>
>Hi, I'm writing a distributed application using XML-RPC over SSL in
>Twisted. I need mutual authentication (server and client) but the
>XML-RPC Proxy in Twisted doesn't take any SSL context so I rewrote a
>Proxy by myself passing my ClientContextFactory subclass to
>reactor.connectSSL.
>Everything works fine but now I need to handle some possible error
>conditions that could prevent the connection, e.g wrong certificates,
>incompatible ciphersuite etc. In other words, I would like to catch
>these "exceptions" and handle them but I don't know how to do it in the
>Twisted framework (using Deferred I guess..).  Any hint?
>Thank you.

SSL error handling is a weak area in Twisted.  It's been improving, but it is still poorly documented.  Perhaps you can motivate some further improvements :)

However, the method you can use to "catch" exceptions related to connecting (SSL or otherwise) is http://twistedmatrix.com/documents/current/api/twisted.internet.protocol.ClientFactory.clientConnectionFailed.html

HTH,

-glyph




More information about the Twisted-Python mailing list