From: Ian Jackson Date: Tue, 23 Jul 2019 16:42:08 +0000 (+0100) Subject: dgit: Use libcurl, not @curl, for git check X-Git-Tag: archive/debian/9.6~5 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=a778f6fe55a7672a9b0052c7b946c5fca5b7c61c;p=dgit.git 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 --- diff --git a/dgit b/dgit index 0f801a3d..978eabe8 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') {