X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=dgit;h=80adf1fdbba1e9f10361aa0e4573b990f901c67b;hb=9949ffa8a74cd5441b9566acabb935bc18d291da;hp=cde85468cfcad54ec99661f9d0ec0d02c2572c4e;hpb=9988391d38561dfa83372cb4a1ba881bbe60d727;p=dgit.git diff --git a/dgit b/dgit index cde85468..80adf1fd 100755 --- a/dgit +++ b/dgit @@ -1223,8 +1223,7 @@ sub archive_api_query_cmd ($) { return @cmd; } -sub api_query ($$;$) { - use JSON; +sub api_query_raw ($$;$) { my ($data, $subpath, $ok404) = @_; badcfg __ "ftpmasterapi archive query method takes no data part" if length $data; @@ -1240,6 +1239,14 @@ sub api_query ($$;$) { return undef if $code eq '404' && $ok404; fail f_ "fetch of %s gave HTTP code %s", $url, $code unless $url =~ m#^file://# or $code =~ m/^2/; + return $json; +} + +sub api_query ($$;$) { + my ($data, $subpath, $ok404) = @_; + use JSON; + my $json = api_query_raw $data, $subpath, $ok404; + return undef unless defined $json; return decode_json($json); }