git: d97c824f5b4c - stable/14 - libfetch: Restore timeout functionality
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 18 Feb 2026 18:39:29 UTC
The branch stable/14 has been updated by des:
URL: https://cgit.FreeBSD.org/src/commit/?id=d97c824f5b4c9e7e3a1400699022cba146e450fa
commit d97c824f5b4c9e7e3a1400699022cba146e450fa
Author: Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2026-02-18 15:10:47 +0000
Commit: Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2026-02-18 18:39:23 +0000
libfetch: Restore timeout functionality
PR: 293124
MFC after: 1 week
Fixes: 792ef1ae7b94 ("Refactor fetch_connect() and fetch_bind() to improve readability and avoid repeating the same DNS lookups.")
Reverts: 8f8a7f6fffd7 ("libfetch: apply timeout to SSL_read()")
Reviewed by: eugen, imp
Differential Revision: https://reviews.freebsd.org/D55293
(cherry picked from commit 73b82d1b0a2f09224e6d0f7a13dd73c66d740207)
(insta-mfc requested by re@)
---
lib/libfetch/common.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/lib/libfetch/common.c b/lib/libfetch/common.c
index d5423d8eb5d1..bdc72f67c9a0 100644
--- a/lib/libfetch/common.c
+++ b/lib/libfetch/common.c
@@ -287,6 +287,9 @@ fetch_reopen(int sd)
flags = fcntl(sd, F_GETFD);
if (flags != -1 && (flags & FD_CLOEXEC) == 0)
(void)fcntl(sd, F_SETFD, flags | FD_CLOEXEC);
+ flags = fcntl(sd, F_GETFL);
+ if (flags != -1 && (flags & O_NONBLOCK) == 0)
+ (void)fcntl(sd, F_SETFL, flags | O_NONBLOCK);
(void)setsockopt(sd, SOL_SOCKET, SO_NOSIGPIPE, &opt, sizeof(opt));
conn->sd = sd;
++conn->ref;
@@ -1272,14 +1275,6 @@ 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) {