diff options
| author | David Broder-Rodgers | 2016-12-10 14:20:47 +0000 |
|---|---|---|
| committer | David Broder-Rodgers | 2017-02-20 19:24:19 +0000 |
| commit | ed9f775b778bad961a9e2fb178fce3a7af201e75 (patch) | |
| tree | a33ba5c326d23e211b8ed73a36e51ed216fa1e89 /Library/Homebrew/dev-cmd | |
| parent | ea440ca3284138ebe3be26d5763f8c6af93749b1 (diff) | |
| download | brew-ed9f775b778bad961a9e2fb178fce3a7af201e75.tar.bz2 | |
Added support for returning HTTP status codes and for git and svn URLs
Diffstat (limited to 'Library/Homebrew/dev-cmd')
| -rw-r--r-- | Library/Homebrew/dev-cmd/audit.rb | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index db7973eb3..839d1c429 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -1490,10 +1490,20 @@ class ResourceAuditor return unless @online urls.each do |url| - begin - nostdout { curl "--connect-timeout", "15", "--output", "/dev/null", "--range", "0-0", url } - rescue ErrorDuringExecution - problem "The mirror #{url} is not reachable (curl exit code #{$?.exitstatus})" + 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" + problem "The mirror #{url} is not reachable (HTTP status code #{status_code})" + end + elsif url.start_with? "git" + unless Utils.git_remote_exists url + problem "The mirror #{url} is not a valid git URL" + end + elsif url.start_with? "svn" + unless Utils.svn_remote_exists url + problem "The mirror #{url} is not a valid svn URL" + end end check_insecure_mirror(url) if url.start_with? "http:" end |
