support for starttls

Johannes Stezenbach js at sig21.net
Mon Apr 11 13:27:27 UTC 2011


On Mon, Apr 11, 2011 at 03:02:30PM +0200, Johannes Stezenbach wrote:
> 
> FWIW, I found I can reproduce the error with a simple
> command line test:

And looking at imaplib2 source:

IMAP4.open() connects to the server, then sets self.read_fd
and starts the self._reader thread, which uses select()
and read() on the socket.

Then starttls() calls ssl.wrap_socket() and updates self.read_fd,
but it seems the self._reader thread eats part of the SSL handshake.

I think to fix this starttls() needs to be done before
starting the self._reader thread.  (Or the thread needs to be killed
before ssl.wrap_socket() and restarted afterwards.)


Johannes



More information about the OfflineIMAP-project mailing list