diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2003-12-09 16:33:18 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2003-12-09 16:33:18 +0000 |
commit | 2760482c3d9728229fa14d06fac0f882ed855e45 (patch) | |
tree | 9df591889e8375880575aec43693a1ef13e719fe | |
parent | 8591744221165c61ae630a55f5c108af4040db4b (diff) | |
download | drakx-move_1.tar drakx-move_1.tar.gz drakx-move_1.tar.bz2 drakx-move_1.tar.xz drakx-move_1.zip |
proxy support during install (thanks to Olivier Blin)move_1
-rw-r--r-- | perl-install/http.pm | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/perl-install/http.pm b/perl-install/http.pm index f1c812b62..ac670691f 100644 --- a/perl-install/http.pm +++ b/perl-install/http.pm @@ -13,16 +13,19 @@ sub getFile { $sock->close if $sock; $url =~ m|/XXX$| and return; #- force closing connection. - my ($host, $port, $path) = $url =~ m,^http://([^/:]+)(?::(\d+))?(/\S*)?$,; + # can be used for ftp urls (with http proxy) + my ($host, $port, $path) = $url =~ m,^(?:http|ftp)://([^/:]+)(?::(\d+))?(/\S*)?$,; $host = resolv($host); - $sock = IO::Socket::INET->new(PeerAddr => $host, - PeerPort => $port || 80, + my $use_http_proxy = $ENV{PROXY} && $ENV{PROXYPORT}; + + $sock = IO::Socket::INET->new(PeerAddr => $use_http_proxy ? $ENV{PROXY} : $host, + PeerPort => $use_http_proxy ? $ENV{PROXYPORT} : $port || 80, Proto => 'tcp', Timeout => 60) or die "can't connect $@"; $sock->autoflush; print $sock join("\015\012" => - "GET $path HTTP/1.0", + "GET " . ($use_http_proxy ? $url : $path) . " HTTP/1.0", "Host: $host" . ($port && ":$port"), "User-Agent: DrakX/vivelinuxabaszindozs", "", ""); |