[Python-Dev] the new 2.3a1 settimeout() with httplib and SSL
Geoffrey Talvola
gtalvola@nameconnector.com
Mon, 27 Jan 2003 16:35:10 -0500
Guido van Rossum [mailto:guido@python.org] wrote:
> > It doesn't look terribly hard to make the SSL wrapper obey
> > the timeout, by
> > calling select() on the "raw" socket before calling
> > SSL_write or SSL_read.
> > I'm willing to try to get this to work.
>
> That's cool. I don't know much about the SSL_read() API -- does it
> promise to read exactly the requested number of byte (unless the
> socket is closed)? Then a single select() before it is called may not
> be sufficient.
I don't know any more than you do -- I've never looked at the OpenSSL docs
until today. It looks like SSL_read may indeed return fewer bytes than
requested: http://www.openssl.org/docs/ssl/SSL_read.html
But I still think that a single select() is OK. It seems to be working fine
in my testing. The select() times out only if there has been no activity on
the socket for the entire timeout period, which seems sufficient to me. I
don't think it matters that SSL_read may return fewer bytes than requested.
Maybe I'm missing something.
Anyhow, I'll do some more testing and then if it still seems to work I'll
upload a patch later today.
- Geoff