diff options
| author | Mike McQuaid | 2016-12-23 19:14:08 +0000 |
|---|---|---|
| committer | GitHub | 2016-12-23 19:14:08 +0000 |
| commit | cd13e306a8147ce702855c769d164546213501bd (patch) | |
| tree | 01c57c6091632d62c569d3e0ca7315e1923fdb89 /Library | |
| parent | 8f85eb64c4875fed514150dec755cb267a96df74 (diff) | |
| parent | 637aae48e4814e2799a06838c24f06a2a2ef0a36 (diff) | |
| download | brew-cd13e306a8147ce702855c769d164546213501bd.tar.bz2 | |
Merge pull request #1693 from broder/homepage_check
Updated homepage 404 check to use explicit parameters and return the …
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/dev-cmd/audit.rb | 9 | ||||
| -rw-r--r-- | Library/Homebrew/test/audit_test.rb | 4 |
2 files changed, 6 insertions, 7 deletions
diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index e83fb2bd0..93431c951 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -569,11 +569,10 @@ class FormulaAuditor end return unless @online - begin - nostdout { curl "--connect-timeout", "15", "-o", "/dev/null", homepage } - rescue ErrorDuringExecution - problem "The homepage is not reachable (curl exit code #{$?.exitstatus})" - end + status_code, = curl_output "--connect-timeout", "15", "--output", "/dev/null", "--range", "0-0", + "--write-out", "%{http_code}", homepage + return if status_code.start_with? "20" + problem "The homepage #{homepage} is not reachable (HTTP status code #{status_code})" end def audit_bottle_spec diff --git a/Library/Homebrew/test/audit_test.rb b/Library/Homebrew/test/audit_test.rb index 2725f906e..dace4dc2b 100644 --- a/Library/Homebrew/test/audit_test.rb +++ b/Library/Homebrew/test/audit_test.rb @@ -429,8 +429,8 @@ class FormulaAuditorTests < Homebrew::TestCase fa.audit_homepage assert_equal ["The homepage should start with http or https " \ - "(URL is #{fa.formula.homepage}).", "The homepage is not reachable " \ - "(curl exit code #{$?.exitstatus})"], fa.problems + "(URL is #{fa.formula.homepage}).", "The homepage #{fa.formula.homepage} is not reachable " \ + "(HTTP status code 000)"], fa.problems formula_homepages = { "bar" => "http://www.freedesktop.org/wiki/bar", |
