Curl: Remove guard from certain parsing logic #13195
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
brew style
with your changes locally?brew typecheck
with your changes locally?brew tests
with your changes locally?@bevanjkay brought it to my attention that some cask PRs started failing on CI with a
The binary url ... is not reachable
error after #11252 was merged. This error message comes from theUtils::Curl#curl_check_http_content
method, which calls#curl_http_content_headers_and_checksum
. Both of these methods were modified in that PR but the issue arises from the latter.Long story short, I naively moved the response parsing logic in
#curl_http_content_headers_and_checksum
into theif status.success?
block and this change causes this error to arise when the download for a URL doesn't finish before the 25 second timeout. Previously, this method would parse the output regardless of whether a final response arrived and this would technically work if there were other responses in the output (e.g., redirections).This PR reinstates the previous behavior by moving the parsing logic back out of the
if status.success?
block, which resolves this issue. We may want to look into this further after this is merged but I wanted to get this fix out relatively quickly, to unblock related cask PRs.I was able to replicate this issue locally (and confirm the fix) using the
visual-paradigm
cask (related open PR: Homebrew/homebrew-cask#122490) because the dmg file is ~750 MB and this will trigger thecurl
timeout. You can test this locally usingbrew audit --cask --appcast --online visual-paradigm
.I've labelled this as "critical", since it's a bug fix. I did a limited amount of testing and didn't see any new errors but if anyone wants to test this more before merging, please feel free. It's very late over here and I'm crawling into bed but I can check on this again in the morning (EDT).