pull: fix status code check in check_bintray_mirror

The status code of the last redirect should be 2xx to be deemed successful.
This commit is contained in:
Zhiming Wang 2017-04-29 19:30:19 -04:00
parent b067700fd7
commit 7a75de7cb1
No known key found for this signature in database
GPG Key ID: 5B58F95EC95965D8

View File

@ -608,7 +608,7 @@ module Homebrew
def check_bintray_mirror(name, url)
headers = curl_output("--connect-timeout", "15", "--head", url)[0]
status_code = headers.scan(%r{^HTTP\/.* (\d+)}).last.first
return if status_code.start_with?("3")
return if status_code.start_with?("2")
opoo "The Bintray mirror #{url} is not reachable (HTTP status code #{status_code})."
opoo "Do you need to upload it with `brew mirror #{name}`?"
end