Andrejs Igumenovs wrote:

> The application use the following functions for non-secure communication:
> int    BIO_write(BIO *b, const void *data, int len);
> int    BIO_read(BIO *b, void *data, int len);
> calling them one by one.

> The issue is that BIO_write() succeeds and returns the proper value of the
> data written. Then the BIO_read() is called and succeeds with no
reasonable
> data read (return value is too small).

The BIO_write function does not glue the bytes together. It just sends them
all. If BIO_read doesn't give you all the data, just call BIO_read again to
get more.

> However the same works with the:
> int  SSL_write(SSL *ssl,const void *buf,int num);
> int  SSL_read(SSL *ssl,void *buf,int num);
> when 'https' is used.

What do you mean by "works"? SSL_read returning 1 is working, and so is
SSL_read returning 10.

> What could it mean ?

It means you don't understand byte stream protocols.

> Please help !

> Is that correct to use BIO for the 'http' protocol at all ?

Yes, but you don't seem to understand the HTTP protocol. The reason you
*have* a protocol is because it tells you when you're done reading.
BIO_read, SSL_read, or even TCP read have no idea how much data you are
expecting, only you do, because the HTTP protocol tells you. But these
low-level functions don't know the high-level protocol.

You have to actually implement the HTTP protocol.

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