summaryrefslogtreecommitdiffstats
path: root/perl-install/http.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2001-03-25 23:07:04 +0000
committerPascal Rigaux <pixel@mandriva.com>2001-03-25 23:07:04 +0000
commit0c399abdf4e07d148abd5ec406e8147538f0cb01 (patch)
tree6762dca0bdb50db043bea665045351401f7be229 /perl-install/http.pm
parenta7f4534e943d1af5d7176442c161217a74ebd195 (diff)
downloaddrakx-0c399abdf4e07d148abd5ec406e8147538f0cb01.tar
drakx-0c399abdf4e07d148abd5ec406e8147538f0cb01.tar.gz
drakx-0c399abdf4e07d148abd5ec406e8147538f0cb01.tar.bz2
drakx-0c399abdf4e07d148abd5ec406e8147538f0cb01.tar.xz
drakx-0c399abdf4e07d148abd5ec406e8147538f0cb01.zip
(getFile): verify the return value of the server. If not 200 (aka Ok),
return undef
Diffstat (limited to 'perl-install/http.pm')
-rw-r--r--perl-install/http.pm8
1 files changed, 4 insertions, 4 deletions
diff --git a/perl-install/http.pm b/perl-install/http.pm
index 8899317b8..48c89d4f7 100644
--- a/perl-install/http.pm
+++ b/perl-install/http.pm
@@ -28,15 +28,15 @@ sub getFile {
#- skip until empty line
local $_;
- my ($now, $last) = 0;
+ my ($now, $last, $tmp) = 0;
+ my $read = sub { sysread($sock, $_, 1) || die; $tmp .= $_ };
do {
$last = $now;
- sysread($sock, $_, 1) || die;
- sysread($sock, $_, 1) || die if /\015/;
+ &$read; &$read if /\015/;
$now = /\012/;
} until ($now && $last);
- $sock;
+ $tmp =~ /^.*\b200\b/ ? $sock : undef;
}
1;