curl_download_strategy: fix caching edgecase - #23917
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
馃煛 Changes recommended
Cache validation can mix the final content type with size or timestamp metadata from an earlier redirect.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Fixes cache validation when an HTML redirect precedes a final response without a content type.
Changes:
- Uses the final response鈥檚 content type for cache validation.
- Adds a redirect regression test.
File summaries
| File | Description |
|---|---|
Library/Homebrew/download_strategy/curl_download_strategy.rb |
Selects content type from the final response. |
Library/Homebrew/test/download_strategies/curl_spec.rb |
Tests cache invalidation after an HTML redirect. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Balanced
馃挕 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
- a redirect's `text/html` prevented the `last-modified` and `content-length` checks when the final response had no `content-type` - casks with `sha256 :no_check` then reinstalled a stale download indefinitely, e.g. `bookends` - a redirect's own `content-length` could likewise reject a valid cached download when the final response was chunked
bevanjkay
force-pushed
the
cache_invalidation_ideas
branch
from
September 10, 2026 01:28
da09dcc to
1997c8f
Compare
Contributor
There was a problem hiding this comment.
馃煝 Approval recommended
The focused implementation correctly addresses redirect-header contamination and includes appropriate regression coverage.
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0 new
- Review effort level: Balanced
carlocab
approved these changes
Sep 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
text/htmlprevented thelast-modifiedandcontent-lengthchecks when the final response had no content-typeResolves https://github.com/orgs/Homebrew/discussions/7045
brew benchmarkresults.brewcommands to reproduce the bug?brew lgtm(style, typechecking and tests) locally?Claude with Opus 5 at High effort, with local review and testing.