[Twisted-Python] twisted.internet.ssl woes

Toni Andjelkovic toni at soth.at
Mon Feb 3 07:14:02 EST 2003

Toni Anđelković wrote on Sat, Feb 01 2003 (18:36:45 +0100):
> However, doc/examples/echoserv_ssl.py fails with another error.
> It looks like internet.tcp.Connection methods get called instead of
> internet.ssl.Connection methods:

Just getting my feet wet with Twisted, so i can't provide you
with a detailed analysis for now. As far as i've seen this line
is being called twice:

> --- <exception caught here> ---
>   File "/usr/local/lib/python2.2/site-packages/twisted/internet/default.py", line 450, in doSelect
>     why = getattr(selectable, method)()

which are

<bound method Port.doRead of <twisted.internet.protocol.Factory on 8000>>
<bound method Server.doRead of <Echo #0 on 8000>>

The first call does the accept() and works (server certificate is
transferred), but the second fails. 

I am unable to deduce why tcp.Connection.doRead is being called
instead of ssl.Connection.doRead; either it is acquired along some
inheritance path from protocol.Protocol (?!), or this call gets
delegated to tcp.Connection.doRead elsewhere.

>   File "/usr/local/lib/python2.2/site-packages/twisted/internet/tcp.py", line 97, in doRead
>     data = self.socket.recv(self.bufferSize)
> SSL.WantReadError: 

This is clear, since tcp.Connection.doRead does not expect a
OpenSSL.SSL.Connection object. The same holds true for

diff -u -U1 -r1.34 ssl.py
--- internet/ssl.py     1 Feb 2003 17:46:03 -0000       1.34
+++ internet/ssl.py     3 Feb 2003 12:00:11 -0000
@@ -256,3 +256,3 @@
-        This accepts a connection and callse self.protocol() to handle the
+        This accepts a connection and calls self.protocol() to handle the
         wire-level protocol.

Toni Andjelkovic
<toni at soth.at>

More information about the Twisted-Python mailing list