56 |
close_connection(); |
close_connection(); |
57 |
return ERROR_NETWORK; |
return ERROR_NETWORK; |
58 |
} |
} |
59 |
strncpy(serv, he->h_name, SERVER_LEN - 1); |
xstrncpy(serv, he->h_name, SERVER_LEN - 1); |
60 |
|
|
61 |
log_info(LOG_SERVER, serv); |
log_info(LOG_SERVER, serv); |
62 |
|
|
177 |
*/ |
*/ |
178 |
int socket_read(char *buf) |
int socket_read(char *buf) |
179 |
{ |
{ |
|
char b[SOCKET_READ_BUF + 1]; |
|
180 |
int flags, e; |
int flags, e; |
181 |
fd_set fds; |
fd_set fds; |
182 |
struct timeval tv; |
struct timeval tv; |
183 |
|
|
184 |
memset(b, 0, SOCKET_READ_BUF + 1); |
memset(buf, 0, RESPONSE_BUF); |
185 |
|
|
186 |
tv.tv_sec = 20; |
tv.tv_sec = 20; |
187 |
tv.tv_usec = 0; |
tv.tv_usec = 0; |
197 |
|
|
198 |
#ifdef SSL_TLS |
#ifdef SSL_TLS |
199 |
if (ssl) |
if (ssl) |
200 |
e = SSL_read(ssl, b, SOCKET_READ_BUF); |
e = SSL_read(ssl, buf, RESPONSE_BUF - 1); |
201 |
else |
else |
202 |
#endif |
#endif |
203 |
e = read(sock, b, SOCKET_READ_BUF); |
e = read(sock, buf, RESPONSE_BUF - 1); |
|
|
|
|
strncat(buf, b, SOCKET_READ_BUF); |
|
204 |
|
|
205 |
fcntl(sock, F_SETFL, flags); |
fcntl(sock, F_SETFL, flags); |
206 |
|
|