package http; # $Id$ use IO::Socket; use network; my $sock; sub getFile { local ($^W) = 0; my ($url) = @_; $sock->close if $sock; $url =~ m|/XXX$| and return; #- force closing connection. my ($host, $port, $path) = $url =~ m,^http://([^/:]+)(?::(\d+))?(/\S*)?$,; $host = network::resolv($host); $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", "", ""); #- skip until empty line my ($now, $last, $buf, $tmp) = 0; my $read = sub { sysread($sock, $buf, 1) || die; $tmp .= $buf }; do { $last = $now; &$read; &$read if $buf =~ /\015/; $now = $buf =~ /\012/; } until $now && $last; $tmp =~ /^.*\b200\b/ ? $sock : undef; } 1; 'distro/mdv2008.0'>distro/mdv2008.0 Mageia Installer and base platform for many utilitiesThierry Vignaud [tv]
summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorPablo Saratxaga <pablo@mandriva.com>2003-01-15 21:57:20 +0000
committerPablo Saratxaga <pablo@mandriva.com>2003-01-15 21:57:20 +0000
commit0c5bc5d262c17df0a9983018c76f83f3bdd936ee (patch)
treec63a5ef6ed58e62be4424950671a63c05e2f5809 /perl-install
parent6fec2c176895de9c67de11dbbc5f8cf1236cedcf (diff)
downloaddrakx-0c5bc5d262c17df0a9983018c76f83f3bdd936ee.tar
drakx-0c5bc5d262c17df0a9983018c76f83f3bdd936ee.tar.gz
drakx-0c5bc5d262c17df0a9983018c76f83f3bdd936ee.tar.bz2
drakx-0c5bc5d262c17df0a9983018c76f83f3bdd936ee.tar.xz
drakx-0c5bc5d262c17df0a9983018c76f83f3bdd936ee.zip
updated pot file
Diffstat (limited to 'perl-install')