Added proxy support

Original change comes from GitHub-User <<carmenates09>>/<<apt-mirror>>@<<01833f2adf4a14ed14ef32ac0d85790826947119>>
Added default variables for 'proxy_user' and 'proxy_password' because this variables can be empty
pull/31/head
eiflera 2014-04-10 13:52:46 +02:00
parent c91c77b3e3
commit 1bea0c5566
2 changed files with 13 additions and 2 deletions

View File

@ -113,7 +113,9 @@ my %config_variables = (
"auth_no_challenge" => 0,
"no_check_certificate" => 0,
"unlink" => 0,
"postmirror_script" => '$var_path/postmirror.sh'
"postmirror_script" => '$var_path/postmirror.sh',
"proxy_user" => '',
"proxy_password" => ''
);
my @config_binaries = ();
@ -228,7 +230,12 @@ sub download_urls
if ( get_variable("auth_no_challenge") == 1 ) { push( @args, "--auth-no-challenge" ); }
if ( get_variable("no_check_certificate") == 1 ) { push( @args, "--no-check-certificate" ); }
if ( get_variable("unlink") == 1 ) { push( @args, "--unlink" ); }
if ( length ( get_variable("use_proxy") ) && ( get_variable("use_proxy") eq 'yes' || get_variable("use_proxy") eq 'on' ) )
{
if ( length ( get_variable("http_proxy") ) ) { push( @args, "-e use_proxy=yes"); push( @args, "-e http_proxy=" . get_variable( "http_proxy" ) ); }
if ( length ( get_variable("proxy_user") ) ) { push( @args, "-e proxy_user=" . get_variable( "proxy_user" ) ); }
if ( length ( get_variable("proxy_password") ) ) { push( @args, "-e proxy_password=" . get_variable( "proxy_password" ) ); }
}
print "Downloading " . scalar(@urls) . " $stage files using $nthreads threads...\n";
while ( scalar @urls )

View File

@ -9,6 +9,10 @@ set nthreads 20
set _tilde 0
# Use --unlink with wget (for use with hardlinked directories)
set unlink 1
set use_proxy off
set http_proxy 127.0.0.1:3128
set proxy_user user
set proxy_password password
deb http://archive.ubuntu.com/ubuntu precise main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu precise-security main restricted universe multiverse