chiark / gitweb /
changelog: Finalise 2.6
[dgit.git] / dgit
diff --git a/dgit b/dgit
index 19a0835a09096809f788bc96d346e6d96805d391..ae07145cb1e58d818d4a232a72cdf8c5737bf705 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -989,7 +989,16 @@ sub api_query ($$) {
     badcfg "ftpmasterapi archive query method takes no data part"
        if length $data;
     my @cmd = archive_api_query_cmd($subpath);
+    my $url = $cmd[$#cmd];
+    push @cmd, qw(-w %{http_code});
     my $json = cmdoutput @cmd;
+    unless ($json =~ s/\d+\d+\d$//) {
+       failedcmd_report_cmd undef, @cmd;
+       fail "curl failed to print 3-digit HTTP code";
+    }
+    my $code = $&;
+    fail "fetch of $url gave HTTP code $code"
+       unless $url =~ m#^file://# or $code =~ m/^2/;
     return decode_json($json);
 }