support for starttls

Sebastian Spaeth sebastian at
Mon Apr 11 16:08:22 BST 2011

On Mon, 11 Apr 2011 15:27:27 +0200, Johannes Stezenbach <js at> wrote:
> 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.)

Great analysis. I concur that this is what must be happening. I
forwarded your analysis to Piers the imaplib2 author. Let's see if he
fixes it.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <>

More information about the OfflineIMAP-project mailing list