I've got some code that seems to work, except when the server responds with
a 'large' amount of data.
When I call SSL_read() I get a SSL_ERROR_SYSCALL error but no data returned.
I've scoured the archive for related questions, but none of the answers
seem to tell me where I'm going wrong.
The code below is typical of what I'm doing. When SSL_read() fails, it
returns -1, and SSL_get_error() returns 5 (SSL_ERROR_SYSCALL), yet slerr
and errno are 0!
Note this is using blocking sockets and very basic OpenSSL stuff, not
unlike http://www.mail-archive.com/openssl-users@openssl.org/msg39534.html
and information gleaned from http://www.rtfm.com/openssl-examples/part1.pdf
and http://www.rtfm.com/openssl-examples/
int ser, r;
r = SSL_write(m_ssl, rq.c_str(), rq.length());
ser = SSL_get_error(m_ssl, r);
if (ser == SSL_ERROR_NONE)
{
char buf[65536];
r = SSL_read(m_ssl, buf, sizeof(buf));
ser = SSL_get_error(m_ssl, r);
if (ser == SSL_ERROR_NONE)
{
fwrite(buf, 1, r, stdout);
}
else
{
int sslerr = ERR_get_error();
int se = 0;
switch (ser)
{
case SSL_ERROR_ZERO_RETURN:
case SSL_ERROR_WANT_READ:
case SSL_ERROR_WANT_WRITE:
case SSL_ERROR_WANT_CONNECT:
case SSL_ERROR_WANT_ACCEPT:
case SSL_ERROR_SYSCALL:
se = errno;
case SSL_ERROR_SSL:
break;
}
}
}
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List openssl-users@openssl.org
Automated List Manager [EMAIL PROTECTED]