summaryrefslogtreecommitdiffstats
path: root/perl-install/http.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/http.pm')
-rw-r--r--perl-install/http.pm30
1 files changed, 30 insertions, 0 deletions
diff --git a/perl-install/http.pm b/perl-install/http.pm
new file mode 100644
index 000000000..fbf6c001c
--- /dev/null
+++ b/perl-install/http.pm
@@ -0,0 +1,30 @@
+package http;
+
+use IO::Socket;
+
+use install_any;
+
+
+my $sock;
+
+sub getFile($) {
+ local($^W) = 0;
+
+ my ($host, $port, $path) = $ENV{URLPREFIX} =~ m,^http://([^/:]+)(?::(\d+))?(/\S*)?$,;
+ $path .= "/" . install_any::relGetFile($_[0]);
+
+ $sock->close if $sock;
+ $sock = IO::Socket::INET->new(PeerAddr => $host,
+ PeerPort => $port || 80,
+ Proto => 'tcp',
+ Timeout => 60) or die "can't connect ";
+ $sock->autoflush;
+ print $sock join("\015\012" =>
+ "GET $path HTTP/1.0",
+ "Host: $host" . ($port && ":$port"),
+ "User-Agent: DrakX/vivelinuxabaszindozs",
+ "", "");
+ $sock;
+}
+
+1;