public inbox for development@lists.ipfire.org
 help / color / mirror / Atom feed
From: Stefan Schantl <stefan.schantl@ipfire.org>
To: development@lists.ipfire.org
Cc: Stefan Schantl <stefan.schantl@ipfire.org>
Subject: [PATCHv2 7/7] http-client-functions.pl: Allow to user define the timeout value.
Date: Fri, 18 Apr 2025 12:54:46 +0200	[thread overview]
Message-ID: <20250418110741.7756-8-stefan.schantl@ipfire.org> (raw)
In-Reply-To: <20250418110741.7756-1-stefan.schantl@ipfire.org>

This allows to specify the the timeout value.
Defaults to to 60 seconds if not set.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
---
 config/cfgroot/http-client-functions.pl | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/config/cfgroot/http-client-functions.pl b/config/cfgroot/http-client-functions.pl
index f1f7de309..c9484c575 100644
--- a/config/cfgroot/http-client-functions.pl
+++ b/config/cfgroot/http-client-functions.pl
@@ -89,6 +89,10 @@ sub downloader (%) {
 	$etagprefix = $args{"ETAGPREFIX"} if (exists($args{"ETAGPREFIX"}));
 	my $max_size = $args{"MAXSIZE"} if (exists($args{"MAXSIZE"}));
 
+	# Timeout defaults to 60 Seconds if not set.
+	my $timeout = 60;
+	$timeout = $args{"TIMEOUT"} if (exists($args{"TIMEOUT"}));
+
 	# Abort with error "no url", if no URL has been given.
 	die "downloader: No URL has been given." unless ($url);
 
@@ -110,8 +114,9 @@ sub downloader (%) {
 		},
 	);
 
-	# Set timeout to 10 seconds.
-	$ua->timeout(10);
+	# Set the timeout to the configured value.
+	# Defaults to 60 seconds if not set.
+	$ua->timeout($timeout);
 
 	# Assign maximum download size if set.
 	$ua->max_size($max_size) if ($max_size);
-- 
2.47.2



      parent reply	other threads:[~2025-04-18 11:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-18 10:54 [PATCHv2 0/7] Introduce perl LWP-based flexible downloader function Stefan Schantl
2025-04-18 10:54 ` [PATCHv2 1/7] http-client-functions.pl: Introduce " Stefan Schantl
2025-04-18 10:54 ` [PATCHv2 2/7] http-client-functions.pl: Add FetchPublicIP function Stefan Schantl
2025-04-18 10:54 ` [PATCHv2 3/7] general-functions.pl: Drop FetchPublicIp function Stefan Schantl
2025-04-18 10:54 ` [PATCHv2 4/7] Move GetDyndnsRedIP from general-functions.pl to http-client-functions.pl Stefan Schantl
2025-04-18 10:54 ` [PATCHv2 5/7] ddns.cgi, wio.cgi: Use GetDyndnsRedIP from http-client-functions.pl file Stefan Schantl
2025-04-18 10:54 ` [PATCHv2 6/7] ids-functions.pl: Use new downloader function from http-client-functions.pl Stefan Schantl
2025-04-18 10:54 ` Stefan Schantl [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250418110741.7756-8-stefan.schantl@ipfire.org \
    --to=stefan.schantl@ipfire.org \
    --cc=development@lists.ipfire.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox