summaryrefslogtreecommitdiffstats
path: root/perl-install/http.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2003-12-09 16:33:18 +0000
committerPascal Rigaux <pixel@mandriva.com>2003-12-09 16:33:18 +0000
commit2760482c3d9728229fa14d06fac0f882ed855e45 (patch)
tree9df591889e8375880575aec43693a1ef13e719fe /perl-install/http.pm
parent8591744221165c61ae630a55f5c108af4040db4b (diff)
downloaddrakx-2760482c3d9728229fa14d06fac0f882ed855e45.tar
drakx-2760482c3d9728229fa14d06fac0f882ed855e45.tar.gz
drakx-2760482c3d9728229fa14d06fac0f882ed855e45.tar.bz2
drakx-2760482c3d9728229fa14d06fac0f882ed855e45.tar.xz
drakx-2760482c3d9728229fa14d06fac0f882ed855e45.zip
proxy support during install (thanks to Olivier Blin)move_1
Diffstat (limited to 'perl-install/http.pm')
-rw-r--r--perl-install/http.pm11
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",
"", "");