diff options
| author | David Broder-Rodgers | 2017-01-10 20:13:14 +0000 |
|---|---|---|
| committer | David Broder-Rodgers | 2017-02-20 19:24:34 +0000 |
| commit | a731f4e17cc45bed5ed0f1121326551c558ce583 (patch) | |
| tree | 41ffbfe46a5a61582bc2170e27716944d6a80c6c | |
| parent | d3ac333197de4d2fcb560bf95e5cd4df81871bbd (diff) | |
| download | brew-a731f4e17cc45bed5ed0f1121326551c558ce583.tar.bz2 | |
Updated HTTP mirror check to use new url_status_code method
| -rw-r--r-- | Library/Homebrew/dev-cmd/audit.rb | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index b323297e4..f187f17f5 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -174,7 +174,7 @@ class FormulaAuditor @specs = %w[stable devel head].map { |s| formula.send(s) }.compact end - def url_status_code(url, range: false) + def self.url_status_code(url, range: false) # The system Curl is too old and unreliable with HTTPS homepages on # Yosemite and below. return "200" unless DevelopmentTools.curl_handles_most_https_homepages? @@ -195,7 +195,7 @@ class FormulaAuditor user_agent: user_agent, ) status_code = Open3.popen3(*args) { |_, stdout, _, _| stdout.read } - break if status_code.start_with? "20" + break if status_code.start_with? "2" end status_code end @@ -619,7 +619,7 @@ class FormulaAuditor return unless @online - status_code = url_status_code(homepage) + status_code = FormulaAuditor.url_status_code(homepage, user_agent: :browser) return if status_code.start_with? "20" problem "The homepage #{homepage} is not reachable (HTTP status code #{status_code})" end @@ -1491,9 +1491,8 @@ class ResourceAuditor return unless @online urls.each do |url| if url.start_with? "http", "ftp" - status_code, = curl_output "--connect-timeout", "15", "--output", "/dev/null", "--range", "0-0", \ - "--write-out", "%{http_code}", url - unless status_code.start_with? "20" + status_code = FormulaAuditor.url_status_code url + unless status_code.start_with? "2" problem "The URL #{url} is not reachable (HTTP status code #{status_code})" end elsif url.start_with? "git" |
