diff options
| author | Mike McQuaid | 2016-12-23 20:29:56 +0000 |
|---|---|---|
| committer | Mike McQuaid | 2016-12-29 12:51:12 +0000 |
| commit | 59180ec370560d461d9fa44a3e510e9f1ea68375 (patch) | |
| tree | 50be2d9b47ecfd4f4b701bff8341dd7774db4fe2 | |
| parent | 6f44dc41d5316e26a3ac533019199da502f430fc (diff) | |
| download | brew-59180ec370560d461d9fa44a3e510e9f1ea68375.tar.bz2 | |
audit: improve reliability of homepage audit.
- Don't run on Yosemite where the system Curl is too old for some modern
HTTPS homepages
- Try up to 3 times in case of transient failures.
| -rw-r--r-- | Library/Homebrew/dev-cmd/audit.rb | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index ef22cbb7a..757cc0df4 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -569,9 +569,20 @@ class FormulaAuditor end return unless @online - 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" + + # The system Curl is too old and unreliable with HTTPS homepages on + # Yosemite and below. + return unless MacOS.version >= :el_capitan + + retries = 3 + retries.times do + 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" + end problem "The homepage #{homepage} is not reachable (HTTP status code #{status_code})" end |
