aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsbosrcarch22
1 files changed, 21 insertions, 1 deletions
diff --git a/sbosrcarch b/sbosrcarch
index c241d1c..777f2c3 100755
--- a/sbosrcarch
+++ b/sbosrcarch
@@ -638,10 +638,13 @@ sub curl_download_http {
user_agent($url) .
" -o'$filename' --retry 2 " .
wget_quote_url($url) .
+ " -D $outfile.hdr " .
" > $outfile 2>&1";
warn "* $cmd\n" if $DEBUG_HTTP;
my $retval = system($cmd);
+ print "curl retval==$retval\n" if $DEBUG_HTTP;
+
if($retval != 0) {
open my $fh, "<$outfile";
while(<$fh>) {
@@ -649,6 +652,22 @@ sub curl_download_http {
}
}
+ open $fh, "<$outfile.hdr";
+ while(<$fh>) {
+ $_ =~ s,[\r\n],,g;
+ next unless /^HTTP\/\S+\s+(\d+)/;
+ $httpstatusline = $_, $httpstatus = $1;
+ }
+
+ unlink($outfile);
+ unlink("$outfile.hdr");
+
+ if($httpstatus ne "200") {
+ print "! $httpstatusline\n";
+ unlink $filename;
+ return undef;
+ }
+
if(-f $filename) {
$size = -s _;
warn "* $filename exists, $size bytes\n" if $DEBUG_HTTP;
@@ -1079,7 +1098,8 @@ sub handle_info_file {
local $maxfilemegs = 0 if whitelisted($category, $prgnam);
download_file($url); # TODO: check result!
}
- if(! -f $filename) {
+ if(! -f $filename || -z $filename) {
+ unlink($filename);
$failcount++;
print "- not downloaded\n";
next;