summaryrefslogtreecommitdiffstats
path: root/urpm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-09-04 09:55:54 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-09-04 09:55:54 +0000
commitee0d94725b20dcf88950a2af0527db8e23aad5f5 (patch)
tree6beed0d61bdbfa6043961380261549120179094f /urpm
parent97d6e91a63b23d2a8029385932603f0bff8aae0d (diff)
downloadurpmi-ee0d94725b20dcf88950a2af0527db8e23aad5f5.tar
urpmi-ee0d94725b20dcf88950a2af0527db8e23aad5f5.tar.gz
urpmi-ee0d94725b20dcf88950a2af0527db8e23aad5f5.tar.bz2
urpmi-ee0d94725b20dcf88950a2af0527db8e23aad5f5.tar.xz
urpmi-ee0d94725b20dcf88950a2af0527db8e23aad5f5.zip
- fix proxy parameter for aria2 (thanks to alkh)
Diffstat (limited to 'urpm')
-rw-r--r--urpm/args.pm2
-rw-r--r--urpm/download.pm8
2 files changed, 8 insertions, 2 deletions
diff --git a/urpm/args.pm b/urpm/args.pm
index e3232893..7207f844 100644
--- a/urpm/args.pm
+++ b/urpm/args.pm
@@ -141,7 +141,7 @@ my %options_spec = (
'retry=s' => sub { $urpm->{options}{retry} = $_[1] },
'proxy=s' => sub {
my (undef, $value) = @_;
- my ($proxy, $port) = $value =~ m,^(?:http://)?([^:/]+(:\d+)?)/*$,
+ my ($proxy, $port) = urpm::download::parse_http_proxy($value)
or die N("bad proxy declaration on command line\n");
$proxy .= ":1080" unless $port;
urpm::download::set_cmdline_proxy(http_proxy => "http://$proxy/");
diff --git a/urpm/download.pm b/urpm/download.pm
index 108e829c..696e22cc 100644
--- a/urpm/download.pm
+++ b/urpm/download.pm
@@ -48,6 +48,10 @@ sub available_metalink_downloaders() {
grep { -x "/usr/bin/$binaries{$_}" || -x "/bin/$binaries{$_}" } metalink_downloaders();
}
+sub parse_http_proxy {
+ $_[0] =~ m!^(?:http://)?([^:/]+(:\d+)?)/*$!;
+}
+
#- parses proxy.cfg (private)
sub load_proxy_config () {
return if defined $proxy_config;
@@ -200,7 +204,9 @@ sub set_proxy {
if defined $p->{user} && defined $p->{pwd};
push @res, '-H', 'Pragma:' if @res;
} elsif ($proxy->{type} =~ /\baria2\b/) {
- push @res, ('--http-proxy', $p->{http_proxy}) if defined $p->{http_proxy};
+ if (my ($http_proxy) = $p->{http_proxy} && parse_http_proxy($p->{http_proxy})) {
+ push @res, ('--http-proxy', $http_proxy);
+ }
push @res, ('--http-proxy', $p->{ftp_proxy}) if defined $p->{ftp_proxy};
push @res, ("--http-proxy-user=$p->{user}", "--http-proxy-passwd=$p->{pwd}")
if defined $p->{user} && defined $p->{pwd};