mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-10-29 11:54:38 +01:00
libfetch: apply timeout to SSL_read()
Currently, fetchTimeout works for non-SSL connections only, so does fetch -T. Fix it applying specified timeout to SSL_read(). MFC after: 3 days
This commit is contained in:
1 parent
ad9932995c
commit
8f8a7f6fff
1 file changed
+8
@@ -1265,6 +1265,14 @@ fetch_ssl_read(SSL *ssl, char *buf, size_t len)
|
||||
{
|
||||
ssize_t rlen;
|
||||
int ssl_err;
|
||||
struct timeval tv;
|
||||
|
||||
if (fetchTimeout > 0) {
|
||||
tv.tv_sec = fetchTimeout;
|
||||
tv.tv_usec = 0;
|
||||
setsockopt(SSL_get_fd(ssl), SOL_SOCKET, SO_RCVTIMEO,
|
||||
&tv, sizeof(tv));
|
||||
}
|
||||
|
||||
rlen = SSL_read(ssl, buf, len);
|
||||
if (rlen < 0) {
|
||||
|
||||
Reference in new issue
Block a user