351 |
|
|
352 |
} |
} |
353 |
|
|
354 |
if ((socket= create_socket(hostname, port, protocol)) == -1) { |
if((socket= create_socket(hostname, port, protocol, NET_TIMEOUT)) == -1) { |
355 |
|
|
356 |
log("%s: create_ssl_socket(): Cannot connect!\n", prog); |
log("%s: create_ssl_socket(): Cannot connect!\n", prog); |
357 |
goto sslerror; |
goto sslerror; |
1183 |
* @param ssl ssl connection |
* @param ssl ssl connection |
1184 |
* @param buffer array to hold the data |
* @param buffer array to hold the data |
1185 |
* @param len size of the data container |
* @param len size of the data container |
1186 |
|
* @param timeout Seconds to wait for data to be available |
1187 |
* @return number of bytes transmitted, -1 in case of an error |
* @return number of bytes transmitted, -1 in case of an error |
1188 |
*/ |
*/ |
1189 |
int recv_ssl_socket(ssl_connection *ssl, void *buffer, int len) { |
int recv_ssl_socket(ssl_connection *ssl, void *buffer, int len, int timeout) { |
1190 |
|
|
1191 |
#ifdef HAVE_OPENSSL |
#ifdef HAVE_OPENSSL |
1192 |
int n= 0; |
int n= 0; |
1197 |
n= SSL_read(ssl->handler, buffer, len); |
n= SSL_read(ssl->handler, buffer, len); |
1198 |
} while(n <= 0 && |
} while(n <= 0 && |
1199 |
BIO_should_retry(ssl->socket_bio) && |
BIO_should_retry(ssl->socket_bio) && |
1200 |
can_read(ssl->socket, 5)); |
can_read(ssl->socket, timeout)); |
1201 |
|
|
1202 |
if(n <= 0) { |
if(n <= 0) { |
1203 |
return -1; |
return -1; |
1233 |
|
|
1234 |
while(i <= len - 1) { |
while(i <= len - 1) { |
1235 |
|
|
1236 |
switch ( recv_ssl_socket(ssl, (void *) &c, 1)) { |
switch ( recv_ssl_socket(ssl, (void *) &c, 1, NET_TIMEOUT)) { |
1237 |
|
|
1238 |
case 1: |
case 1: |
1239 |
|
|