diff options
| author | Mike McQuaid | 2017-02-23 09:09:33 +0000 |
|---|---|---|
| committer | Mike McQuaid | 2017-02-23 09:09:33 +0000 |
| commit | 5390897883f11fe2257e57bd5547cb1bbb144fb0 (patch) | |
| tree | 4a7afb3e9863b5f585fc4d985f30551ce37a5dfc /Library/Homebrew | |
| parent | 125a6eee2165039d3b7329543d2e33e321c267d2 (diff) | |
| download | brew-5390897883f11fe2257e57bd5547cb1bbb144fb0.tar.bz2 | |
audit: refactor http content checks.
Diffstat (limited to 'Library/Homebrew')
| -rw-r--r-- | Library/Homebrew/dev-cmd/audit.rb | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index b63d39905..aa9dd775a 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -1492,7 +1492,7 @@ class ResourceAuditor urls.each do |url| strategy = DownloadStrategyDetector.detect(url) if strategy <= CurlDownloadStrategy && !url.start_with?("file") - check_http_mirror url + check_http_content url elsif strategy <= GitDownloadStrategy unless Utils.git_remote_exists url problem "The URL #{url} is not a valid git URL" @@ -1505,7 +1505,7 @@ class ResourceAuditor end end - def check_http_mirror(url) + def check_http_content(url) details = get_content_details(url) if details[:status].nil? @@ -1519,10 +1519,16 @@ class ResourceAuditor secure_url = url.sub "http", "https" secure_details = get_content_details(secure_url) - return if !details[:status].start_with?("2") || !secure_details[:status].start_with?("2") + if !details[:status].to_s.start_with?("2") || + !secure_details[:status].to_s.start_with?("2") + return + end - etag_match = details[:etag] && details[:etag] == secure_details[:etag] - content_length_match = details[:content_length] && details[:content_length] == secure_details[:content_length] + etag_match = details[:etag] && + details[:etag] == secure_details[:etag] + content_length_match = + details[:content_length] && + details[:content_length] == secure_details[:content_length] file_match = details[:file_hash] == secure_details[:file_hash] return if !etag_match && !content_length_match && !file_match |
