Sudarshan Soma

> Hi All,
> This is a basic question. But can anyone please clarify if this
> is correct?

> These are the steps iam doing for a read on SSL socket for http requests.

> I ) wait on select call on  socket descriptor, until read hit occurs
> (on timeout param)

That's a mistake. Suppose, OpenSSL has already read the data from the
socket. You will never get a read hit. You should only wait on 'select' if
OpenSSL specifically tells you to do so.

> 2)  read incrementally with SSL_read() from that SSL descriptor
> (or in other words - get all data from SSL buffers )
> 3) goto step1

> Without the select call, i am seeing that application gets blocked on
> SSL_read call.

That's because you have selected blocking operation.

> Should i call the first step, calling select. It doesnt seem to hang,
> (which might be wrong since SSL buffering might result hanging select,
> if the data is stored in SSL buffers) .

Exactly.

> Also I dont see anywhere mentioned, that "select" has to be used, so
> please confirm if this is the right way to do it.
>
> Please let me know if iam misssing something.

If you don't want to block, don't use blocking sockets and/or blocking BIOs.

Do not refuse to call SSL_read/SSL_write. Call them *first*. If you need to
use 'select' or 'poll', they will tell you with WANT_READ/WANT_WRITE
returns.

DS


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to