summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2019-07-23 17:42:08 +0100
committerIan Jackson <ijackson@chiark.greenend.org.uk>2019-07-23 21:58:56 +0100
commita778f6fe55a7672a9b0052c7b946c5fca5b7c61c (patch)
treefe86091fe16f1e64054b737340c93c7f50057320
parente9957b2d5326b0bdce0e5ca314fde99e213f53d8 (diff)
dgit: Use libcurl, not @curl, for git check
This means that when we sort out our TLS problems this will be fixed too. The remaining use of command-line curl is just to download additional .dsc compoments. I intend to leave that as-is. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
-rwxr-xr-xdgit21
1 files changed, 5 insertions, 16 deletions
diff --git a/dgit b/dgit
index 0f801a3..978eabe 100755
--- a/dgit
+++ b/dgit
@@ -1804,22 +1804,11 @@ sub check_for_git () {
my $suffix = access_cfg('git-check-suffix','git-suffix',
'RETURN-UNDEF') // '.git';
my $url = "$prefix/$package$suffix";
- my @cmd = (@curl, qw(-sS -I), $url);
- my $result = cmdoutput @cmd;
- $result =~ s/^\S+ 200 .*\n\r?\n//;
- # curl -sS -I with https_proxy prints
- # HTTP/1.0 200 Connection established
- $result =~ m/^\S+ (404|200) /s or
- fail +(__ "unexpected results from git check query - ").
- Dumper($prefix, $result);
- my $code = $1;
- if ($code eq '404') {
- return 0;
- } elsif ($code eq '200') {
- return 1;
- } else {
- die;
- }
+ my $result = url_fetch $url,
+ CurlOpts => { CURLOPT_NOBODY() => 1 },
+ Ok404 => 1,
+ AccessBase => 'git-check';
+ return defined $result;
} elsif ($how eq 'true') {
return 1;
} elsif ($how eq 'false') {