mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-27 19:23:24 +02:00
url-filter: Use upstream proxy when downloading blacklists
Fixes #10690 Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
This commit is contained in:
@@ -23,6 +23,8 @@
|
||||
|
||||
package Network;
|
||||
|
||||
require "/var/ipfire/general-functions.pl";
|
||||
|
||||
use Socket;
|
||||
|
||||
my %PREFIX2NETMASK = (
|
||||
@@ -244,6 +246,31 @@ sub ip_address_in_network($$) {
|
||||
return (($address_bin ge $network_bin) && ($address_bin le $broadcast_bin));
|
||||
}
|
||||
|
||||
sub setup_upstream_proxy() {
|
||||
my %proxysettings = ();
|
||||
&General::readhash("${General::swroot}/proxy/settings", \%proxysettings);
|
||||
|
||||
if ($proxysettings{'UPSTREAM_PROXY'}) {
|
||||
my $credentials = "";
|
||||
|
||||
if ($proxysettings{'UPSTREAM_USER'}) {
|
||||
$credentials = $proxysettings{'UPSTREAM_USER'};
|
||||
|
||||
if ($proxysettings{'UPSTREAM_PASSWORD'}) {
|
||||
$credentials .= ":" . $proxysettings{'UPSTREAM_PASSWORD'};
|
||||
}
|
||||
|
||||
$credentials .= "@";
|
||||
}
|
||||
|
||||
my $proxy = "http://" . $credentials . $proxysettings{'UPSTREAM_PROXY'};
|
||||
|
||||
$ENV{'http_proxy'} = $proxy;
|
||||
$ENV{'https_proxy'} = $proxy;
|
||||
$ENV{'ftp_proxy'} = $proxy;
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
# Remove the next line to enable the testsuite
|
||||
|
||||
Reference in New Issue
Block a user