Skip to content

Commit

Permalink
Merge pull request NixOS#654 from utdemir/more-insecure-verify-https-…
Browse files Browse the repository at this point in the history
…binary-caches

Also set CURLOPT_SSL_VERIFYHOST=0 when "verify-https-binary-caches" is false
  • Loading branch information
edolstra committed Sep 27, 2015
2 parents aaf8a1c + a49514a commit bdc4a0b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion scripts/download-from-binary-cache.pl.in
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,12 @@ sub addRequest {
$curl->setopt(CURLOPT_WRITEDATA, $fh);
$curl->setopt(CURLOPT_FOLLOWLOCATION, 1);
$curl->setopt(CURLOPT_CAINFO, $caBundle) if defined $caBundle;
$curl->setopt(CURLOPT_SSL_VERIFYPEER, 0) unless isTrue($Nix::Config::config{"verify-https-binary-caches"} // "1");

unless (isTrue($Nix::Config::config{"verify-https-binary-caches"} // "1")) {
$curl->setopt(CURLOPT_SSL_VERIFYPEER, 0);
$curl->setopt(CURLOPT_SSL_VERIFYHOST, 0);
}

$curl->setopt(CURLOPT_USERAGENT, $userAgent);
$curl->setopt(CURLOPT_NOBODY, 1) if $head;
$curl->setopt(CURLOPT_FAILONERROR, 1);
Expand Down

0 comments on commit bdc4a0b

Please sign in to comment.