mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Curl: Remove guard from certain parsing logic
The `#curl_http_content_headers_and_checksum` method previously parsed responses from `curl` output even if `status.success?` wasn't `true`. A recent commit of mine moved the parsing logic behind this guard but it's now leading to a "...is not reachable" error when a URL involves a large download that takes longer than 25 seconds to finish and hits the timeout. This commit resolves the issue for the time being by moving related logic back to its previous location, where it isn't guarded by `status.success?`.
This commit is contained in:
parent
ea264344f3
commit
d6202384d7
@ -345,20 +345,20 @@ module Utils
|
||||
user_agent: user_agent
|
||||
)
|
||||
|
||||
parsed_output = parse_curl_output(output)
|
||||
responses = parsed_output[:responses]
|
||||
|
||||
final_url = curl_response_last_location(responses)
|
||||
headers = if responses.last.present?
|
||||
status_code = responses.last[:status_code]
|
||||
responses.last[:headers]
|
||||
else
|
||||
{}
|
||||
end
|
||||
etag = headers["etag"][ETAG_VALUE_REGEX, 1] if headers["etag"].present?
|
||||
content_length = headers["content-length"]
|
||||
|
||||
if status.success?
|
||||
parsed_output = parse_curl_output(output)
|
||||
responses = parsed_output[:responses]
|
||||
|
||||
final_url = curl_response_last_location(responses)
|
||||
headers = if responses.last.present?
|
||||
status_code = responses.last[:status_code]
|
||||
responses.last[:headers]
|
||||
else
|
||||
{}
|
||||
end
|
||||
etag = headers["etag"][ETAG_VALUE_REGEX, 1] if headers["etag"].present?
|
||||
content_length = headers["content-length"]
|
||||
|
||||
file_contents = File.read(file.path)
|
||||
file_hash = Digest::SHA2.hexdigest(file_contents) if hash_needed
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user