From a778f6fe55a7672a9b0052c7b946c5fca5b7c61c Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 23 Jul 2019 17:42:08 +0100 Subject: [PATCH] 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 --- dgit | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) 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') { -- 2.30.2