package http; # $Id$ use IO::Socket; use network::network; my $sock; sub getFile { local ($^W) = 0; my ($url) = @_; $sock->close if $sock; $url =~ m|/XXX$| and return; #- force closing connection. # can be used for ftp urls (with http proxy) my ($host, $port, $path) = $url =~ m,^(?:http|ftp)://([^/:]+)(?::(\d+))?(/\S*)?$,; defined $host or return undef; 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 not connect $@"; $sock->autoflush; print $sock join("\015\012" => "GET " . ($use_http_proxy ? $url : $path) . " HTTP/1.0", "Host: $host" . ($port && ":$port"), "User-Agent: DrakX/vivelinuxabaszindozs", "", ""); #- skip until empty line my $now = 0; my ($last, $buf, $tmp); my $read = sub { sysread($sock, $buf, 1) or die ''; $tmp .= $buf }; do { $last = $now; &$read; &$read if $buf =~ /\015/; $now = $buf =~ /\012/; } until $now && $last; if ($tmp =~ /^(.*\b(\d+)\b.*)/ && $2 == 200) { $sock; } else { log::l("HTTP error: $1"); undef; } } 1; tro/mdv2009.0'>distro/mdv2009.0 Mageia Installer and base platform for many utilitiesThierry Vignaud [tv]
summaryrefslogtreecommitdiffstats
path: root/perl-install/do_resize_fat
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2001-09-25 11:38:57 +0000
committerPascal Rigaux <pixel@mandriva.com>2001-09-25 11:38:57 +0000
commit98be23c623068a20d20d6a4072d7bdb57d097894 (patch)
tree3248d1a7d2eef3b386b9bd4e083b0b39fad3bab7 /perl-install/do_resize_fat
parentdd1f0e8a4960567ad8aa0c44f1b75887bf5818a4 (diff)
downloaddrakx-backup-do-not-use-98be23c623068a20d20d6a4072d7bdb57d097894.tar
drakx-backup-do-not-use-98be23c623068a20d20d6a4072d7bdb57d097894.tar.gz
drakx-backup-do-not-use-98be23c623068a20d20d6a4072d7bdb57d097894.tar.bz2
drakx-backup-do-not-use-98be23c623068a20d20d6a4072d7bdb57d097894.tar.xz
drakx-backup-do-not-use-98be23c623068a20d20d6a4072d7bdb57d097894.zip
*** empty log message ***
Diffstat (limited to 'perl-install/do_resize_fat')
0 files changed, 0 insertions, 0 deletions