git: 2305dcc115e8 - stable/13 - MFC: libfetch: apply timeout to SSL_read()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 25 Jan 2026 04:15:12 UTC
The branch stable/13 has been updated by eugen:
URL: https://cgit.FreeBSD.org/src/commit/?id=2305dcc115e815b1b6b0259977afddb918f31a26
commit 2305dcc115e815b1b6b0259977afddb918f31a26
Author: Eugene Grosbein <eugen@FreeBSD.org>
AuthorDate: 2026-01-22 08:40:35 +0000
Commit: Eugene Grosbein <eugen@FreeBSD.org>
CommitDate: 2026-01-25 04:14:54 +0000
MFC: 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().
(cherry picked from commit 8f8a7f6fffd7dca09013f7c4bfa075bc3825fb8e)
---
lib/libfetch/common.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/lib/libfetch/common.c b/lib/libfetch/common.c
index 69b507109bc4..e392c9e1e285 100644
--- a/lib/libfetch/common.c
+++ b/lib/libfetch/common.c
@@ -1287,6 +1287,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) {