diff options
author | Rafael Garcia-Suarez <rgarciasuarez@mandriva.org> | 2004-08-30 06:42:40 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@mandriva.org> | 2004-08-30 06:42:40 +0000 |
commit | 85bc3fdeb2488c4e7fddddad7af28fa989755124 (patch) | |
tree | 796c25bb4176bbaddf926d85f69826c074d9cbf0 /urpm/download.pm | |
parent | a65cb3d01e8aa593be03ceef36b32c3838ba0c1f (diff) | |
download | urpmi-85bc3fdeb2488c4e7fddddad7af28fa989755124.tar urpmi-85bc3fdeb2488c4e7fddddad7af28fa989755124.tar.gz urpmi-85bc3fdeb2488c4e7fddddad7af28fa989755124.tar.bz2 urpmi-85bc3fdeb2488c4e7fddddad7af28fa989755124.tar.xz urpmi-85bc3fdeb2488c4e7fddddad7af28fa989755124.zip |
urpmi+curl couldn't download files with protected urls where the user
name was containing a '@'
Diffstat (limited to 'urpm/download.pm')
-rw-r--r-- | urpm/download.pm | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/urpm/download.pm b/urpm/download.pm index 1c3ff0ae..e35538e8 100644 --- a/urpm/download.pm +++ b/urpm/download.pm @@ -22,7 +22,7 @@ sub import () { sync_file sync_wget sync_curl sync_rsync sync_ssh set_proxy_config dump_proxy_config )) { - *{$c.'::'.$symbol} = *$symbol; + *{$c . '::' . $symbol} = *$symbol; } } @@ -50,11 +50,11 @@ sub load_proxy_config () { sub dump_proxy_config () { return 0 unless defined $proxy_config; #- hasn't been read yet open my $f, '>', $PROXY_CFG or return 0; - print $f "# generated ".(scalar localtime)."\n"; - for ('', sort grep { !/^(|cmd_line)$/ } keys %$proxy_config) { + print $f "# generated " . (scalar localtime) . "\n"; + foreach ('', sort grep { !/^(|cmd_line)$/ } keys %$proxy_config) { my $m = $_ eq '' ? '' : "$_:"; my $p = $proxy_config->{$_}; - for (qw(http_proxy ftp_proxy)) { + foreach (qw(http_proxy ftp_proxy)) { defined $p->{$_} && $p->{$_} ne '' and print $f "$m$_=$p->{$_}\n"; } @@ -97,7 +97,7 @@ sub set_cmdline_proxy { user => undef, pwd => undef, }; - $proxy_config->{cmd_line}{$_} = $h{$_} for keys %h; + $proxy_config->{cmd_line}{$_} = $h{$_} foreach keys %h; } #- changes permanently the proxy settings @@ -235,6 +235,11 @@ sub sync_curl { chdir($options->{dir}); my (@ftp_files, @other_files); foreach (@_) { + my ($proto, $nick, $rest) = m,^(http|ftp)://([^:/]+):(.*),,; + if ($nick) { #- escape @ in user names + $nick =~ s/@/%40/; + $_ = "$proto://$nick:$rest"; + } m|^ftp://.*/([^/]*)$| && -e $1 && -s _ > 8192 and do { push @ftp_files, $_; next; }; #- manage time stamp for large file only. |