Diagnose EOF on memory BIOs (or you just get mysterious errors with no error

message).
This commit is contained in:
Ben Laurie 2000-08-28 12:54:18 +00:00
parent 065866b28d
commit b3756cf0e9
3 changed files with 6 additions and 0 deletions

View File

@ -638,6 +638,7 @@ int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args);
#define BIO_F_CONN_CTRL 127
#define BIO_F_CONN_STATE 115
#define BIO_F_FILE_CTRL 116
#define BIO_F_MEM_READ 128
#define BIO_F_MEM_WRITE 117
#define BIO_F_SSL_NEW 118
#define BIO_F_WSASTARTUP 119
@ -648,6 +649,7 @@ int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args);
#define BIO_R_BAD_HOSTNAME_LOOKUP 102
#define BIO_R_BROKEN_PIPE 124
#define BIO_R_CONNECT_ERROR 103
#define BIO_R_EOF_ON_MEMORY_BIO 127
#define BIO_R_ERROR_SETTING_NBIO 104
#define BIO_R_ERROR_SETTING_NBIO_ON_ACCEPTED_SOCKET 105
#define BIO_R_ERROR_SETTING_NBIO_ON_ACCEPT_SOCKET 106

View File

@ -91,6 +91,7 @@ static ERR_STRING_DATA BIO_str_functs[]=
{ERR_PACK(0,BIO_F_CONN_CTRL,0), "CONN_CTRL"},
{ERR_PACK(0,BIO_F_CONN_STATE,0), "CONN_STATE"},
{ERR_PACK(0,BIO_F_FILE_CTRL,0), "FILE_CTRL"},
{ERR_PACK(0,BIO_F_MEM_READ,0), "MEM_READ"},
{ERR_PACK(0,BIO_F_MEM_WRITE,0), "MEM_WRITE"},
{ERR_PACK(0,BIO_F_SSL_NEW,0), "SSL_new"},
{ERR_PACK(0,BIO_F_WSASTARTUP,0), "WSASTARTUP"},
@ -104,6 +105,7 @@ static ERR_STRING_DATA BIO_str_reasons[]=
{BIO_R_BAD_HOSTNAME_LOOKUP ,"bad hostname lookup"},
{BIO_R_BROKEN_PIPE ,"broken pipe"},
{BIO_R_CONNECT_ERROR ,"connect error"},
{BIO_R_EOF_ON_MEMORY_BIO ,"eof on memory bio"},
{BIO_R_ERROR_SETTING_NBIO ,"error setting nbio"},
{BIO_R_ERROR_SETTING_NBIO_ON_ACCEPTED_SOCKET,"error setting nbio on accepted socket"},
{BIO_R_ERROR_SETTING_NBIO_ON_ACCEPT_SOCKET,"error setting nbio on accept socket"},

View File

@ -166,6 +166,8 @@ static int mem_read(BIO *b, char *out, int outl)
if (b->num != 0)
BIO_set_retry_read(b);
ret= b->num;
if(ret < 0)
BIOerr(BIO_F_MEM_READ,BIO_R_EOF_ON_MEMORY_BIO);
}
return(ret);
}