[PATCHv2,0/7] Introduce perl LWP-based flexible downloader function

Message ID 20250418110741.7756-1-stefan.schantl@ipfire.org
Headers
Series Introduce perl LWP-based flexible downloader function |

Message

Stefan Schantl April 18, 2025, 10:54 a.m. UTC
  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