Controlling OpenSSL's use of read() and write()

2005-05-25 Thread Hrvoje Niksic
Does anyone know if it is possible, and how, to control the way
OpenSSL communicates with the remote host?  Wget normally precedes
each read() and write() with a select() that enforces the idle timeout
specified by the user using --read-timeout and --timeout.

In SSL it is not enough to select() before SSL_read because SSL_read
can and does call read multiple times, which breaks the intended
timeout semantics.  Is there a way to prevent this?

Manual for BIO_new_bio_pair(3) indicates that this could be done by
obtaining a BIO pair:

   The BIO pair can be used to have full control over the network
   access of an application. The application can call select() on
   the socket as required without having to go through the
   SSL-interface.

However, it doesn't go on to provide an example how to do so, it only
offers a vague description.


Re: Controlling OpenSSL's use of read() and write()

2005-05-25 Thread Daniel Stenberg

On Wed, 25 May 2005, Hrvoje Niksic wrote:

In SSL it is not enough to select() before SSL_read because SSL_read can and 
does call read multiple times, which breaks the intended timeout semantics. 
Is there a way to prevent this?


I figure one way is to use non-blocking sockets, isn't it?

--
 -=- Daniel Stenberg -=- http://daniel.haxx.se -=-
  ech`echo xiun|tr nu oc|sed 'sx\([sx]\)\([xoi]\)xo un\2\1 is xg'`ol


Re: Controlling OpenSSL's use of read() and write()

2005-05-25 Thread Hrvoje Niksic
Daniel Stenberg [EMAIL PROTECTED] writes:

 On Wed, 25 May 2005, Hrvoje Niksic wrote:

 In SSL it is not enough to select() before SSL_read because
 SSL_read can and does call read multiple times, which breaks the
 intended timeout semantics. Is there a way to prevent this?

 I figure one way is to use non-blocking sockets, isn't it?

That seems more trouble than it is worth, unless you already have an
infrastructure that supports non-blocking sockets.