From 0c399abdf4e07d148abd5ec406e8147538f0cb01 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Sun, 25 Mar 2001 23:07:04 +0000 Subject: (getFile): verify the return value of the server. If not 200 (aka Ok), return undef --- perl-install/http.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'perl-install/http.pm') 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; -- cgit v1.2.1