From patchwork Fri Apr 18 10:54:39 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schantl X-Patchwork-Id: 25 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) client-signature RSA-PSS (4096 bits)) (Client CN "mail01.haj.ipfire.org", Issuer "R10" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4ZfC1639yFz3wb5 for ; Fri, 18 Apr 2025 11:18:02 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) client-signature ECDSA (secp384r1)) (Client CN "mail02.haj.ipfire.org", Issuer "E5" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4ZfC1444Ffz34x for ; Fri, 18 Apr 2025 11:18:00 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4ZfC143KFNz334l for ; Fri, 18 Apr 2025 11:18:00 +0000 (UTC) X-Original-To: development@lists.ipfire.org Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) client-signature RSA-PSS (4096 bits)) (Client CN "mail01.haj.ipfire.org", Issuer "R10" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4ZfC1138K4z2xng for ; Fri, 18 Apr 2025 11:17:57 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4ZfC0y3z2Qz74; Fri, 18 Apr 2025 11:17:54 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1744975076; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=1NSQyShfujHn3cj8En3AJwU4s6e34NNn4Ga0xvFjfVk=; b=PXyyXCGDdQLRVgSw52T9pES0bBaxCRSBeB50+u9G8jpKkQhjpltEB9bRWebBdIyoyqyqcX J3z0MtBTn+YqyxDA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1744975076; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=1NSQyShfujHn3cj8En3AJwU4s6e34NNn4Ga0xvFjfVk=; b=I0MHN/53L2zAqeil/oqKLZYRcHizf+R+RjetyAPKWfHfIVXqnUiNQranQGaDNH+GyhJt0R n+zSR0deRarcaZb1m5N/mHtZ/i8LeAOT88vrhEsO2243M3F5fhGY4a4jke6tbqfviWsLfO flWogV4w+HgstO/WtaHSbKqkFcBgtU26YcmGG3dMLk/RDlNaMke6uBU5jcyhlFIgl8ync1 IbZZXj1YcrVh868o/YQYT/6SxTVgEtfPgvX07Hkfr1F+Adjc23Fj5iiouytrOhicqNFx+o OwsTX74kObhsbVIeXa+TOq65SSEx12bnLsal8CBXsA3jAu+7Jb5BTPCZl+Lk2w== From: Stefan Schantl To: development@lists.ipfire.org Cc: Stefan Schantl Subject: [PATCHv2 0/7] Introduce perl LWP-based flexible downloader function Date: Fri, 18 Apr 2025 12:54:39 +0200 Message-ID: <20250418110741.7756-1-stefan.schantl@ipfire.org> Precedence: list List-Id: List-Subscribe: , List-Unsubscribe: , List-Post: List-Help: Sender: Mail-Followup-To: MIME-Version: 1.0 This reworked patchset contains a libwwwperl based flexible downloader function which easily can be used to download files or grab and display any web content. The function now has been moved into an own perl library file (http-client-functions.pl) in order to cleanup the general functions library file. This should help to speed up the WUI by avoid to load to much and big perl modules. The FetchPublicIp function has been reworked to use the new downloader and therefore moved to the http-client-functions file. As a result of this, the GetDyndnsRedIP function, which is using that function also has to be moved to the new library file and some existing CGI files needed to be adjusted to work properly again. The following changes from the feedback of the previously sent patchset are also part of this patchset: * Move the downloader into a seperate file. * Die in case no URL has been passed to the downloader. * Allow to specify the timeout time (default to 60sec if not set) insted of hardcode it. -Stefan Stefan Schantl (7): http-client-functions.pl: Introduce LWP-based flexible downloader function. http-client-functions.pl: Add FetchPublicIP function. general-functions.pl: Drop FetchPublicIp function. Move GetDyndnsRedIP from general-functions.pl to http-client-functions.pl ddns.cgi, wio.cgi: Use GetDyndnsRedIP from http-client-functions.pl file ids-functions.pl: Use new downloader function from http-client-functions.pl http-client-functions.pl: Allow to user define the timeout value. config/cfgroot/general-functions.pl | 46 ---- config/cfgroot/http-client-functions.pl | 345 ++++++++++++++++++++++++ config/cfgroot/ids-functions.pl | 206 ++------------ config/rootfiles/common/configroot | 1 + html/cgi-bin/ddns.cgi | 3 +- html/cgi-bin/wio.cgi | 3 +- lfs/configroot | 1 + 7 files changed, 369 insertions(+), 236 deletions(-) create mode 100644 config/cfgroot/http-client-functions.pl