Skip to content

Commit

Permalink
Use --insecure to download ca-certificates source where necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
Bo98 committed Oct 4, 2021
1 parent ebc0783 commit 21ec17d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Library/Homebrew/download_strategy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,8 @@ def _curl_args

args += [meta[:header], meta[:headers]].flatten.compact.flat_map { |h| ["--header", h.strip] }

args += ["--insecure"] if meta[:insecure]

args
end

Expand Down
12 changes: 10 additions & 2 deletions Library/Homebrew/resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ def initialize(name = nil, &block)
def owner=(owner)
@owner = owner
patches.each { |p| p.owner = owner }

return if !owner.is_a?(SoftwareSpec) || owner.full_name != "ca-certificates"

@specs[:insecure] = !DevelopmentTools.ca_file_handles_most_https_certificates?
end

def downloader
Expand Down Expand Up @@ -170,10 +174,14 @@ def sha256(val)
def url(val = nil, **specs)
return @url if val.nil?

specs = specs.dup
# Don't allow this to be set.
specs.delete(:insecure)

@url = val
@specs.merge!(specs)
@using = @specs.delete(:using)
@using = specs.delete(:using)
@download_strategy = DownloadStrategyDetector.detect(url, using)
@specs.merge!(specs)
@downloader = nil
end

Expand Down

0 comments on commit 21ec17d

Please sign in to comment.