diff options
| author | Markus Reiter | 2017-12-05 21:34:50 +0100 |
|---|---|---|
| committer | GitHub | 2017-12-05 21:34:50 +0100 |
| commit | 497348a8b7413e48cf78cf9bf4d7904db627c9ee (patch) | |
| tree | c510e15181f65acbbcb3a009c91b4e5788adf0ec /Library/Homebrew/cask/lib | |
| parent | 8de97dca14ecc9cfe55969401b85f36c9367bece (diff) | |
| parent | b1328adaa9030a3a7ed6127fe0662b0ae51f270b (diff) | |
| download | brew-497348a8b7413e48cf78cf9bf4d7904db627c9ee.tar.bz2 | |
Merge pull request #3318 from Git-Jiro/improve_audit
Add audit check for URL schema
Diffstat (limited to 'Library/Homebrew/cask/lib')
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/audit.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/audit.rb b/Library/Homebrew/cask/lib/hbc/audit.rb index d757b0623..d53d26ffc 100644 --- a/Library/Homebrew/cask/lib/hbc/audit.rb +++ b/Library/Homebrew/cask/lib/hbc/audit.rb @@ -2,6 +2,7 @@ require "hbc/checkable" require "hbc/download" require "digest" require "utils/git" +require "utils/curl" module Hbc class Audit @@ -30,6 +31,7 @@ module Hbc check_url check_generic_artifacts check_token_conflicts + check_https_availability check_download check_single_pre_postflight check_single_uninstall_zap @@ -275,6 +277,17 @@ module Hbc "#{core_tap.default_remote}/blob/master/Formula/#{cask.token}.rb" end + def check_https_availability + check_url_for_https_availability(cask.url, user_agents: [cask.url.user_agent]) unless cask.url.to_s.empty? + check_url_for_https_availability(cask.appcast) unless cask.appcast.to_s.empty? + check_url_for_https_availability(cask.homepage) unless cask.homepage.to_s.empty? + end + + def check_url_for_https_availability(url_to_check, user_agents: [:default]) + problem = curl_check_http_content(url_to_check.to_s, user_agents: user_agents) + add_error problem unless problem.nil? + end + def check_download return unless download && cask.url odebug "Auditing download" |
