From 2760482c3d9728229fa14d06fac0f882ed855e45 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Tue, 9 Dec 2003 16:33:18 +0000 Subject: proxy support during install (thanks to Olivier Blin) --- perl-install/http.pm | 11 +++++++---- 1 file 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", "", ""); -- cgit v1.2.1