livecheck: add compressed option#22757
Open
samford wants to merge 2 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a compressed option to the livecheck url DSL/options plumbing to allow Strategy.page_content to omit curl --compressed for problematic endpoints (e.g., AWS Content-Encoding: aws-chunked responses), and expands tests for existing cookies/header handling.
Changes:
- Add
compressedtoLivecheck::Optionsand thelivecheckurlDSL, and use it to control whetherStrategy.page_contentappends--compressed. - Update option equality/url-options serialization to include
compressed. - Add/extend specs for
compressed,cookies, andheaderoption behavior.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| Library/Homebrew/livecheck/strategy.rb | Makes --compressed conditional in Strategy.page_content based on options.compressed. |
| Library/Homebrew/livecheck/options.rb | Introduces compressed option and includes it in url_options/equality. |
| Library/Homebrew/livecheck.rb | Extends the url DSL method signature and option assignment to include compressed. |
| Library/Homebrew/test/livecheck/strategy_spec.rb | Adds a spec for the new compressed option (currently not asserting the key behavior). |
| Library/Homebrew/test/livecheck/options_spec.rb | Updates specs to include compressed in option hashes and defaults. |
| Library/Homebrew/test/livecheck_spec.rb | Extends DSL-level option tests to assert compressed, cookies, and header values are set. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This adds a `compressed` `url` option for `livecheck` blocks, so we can selectively omit the curl `--compressed` argument that we use by default for `Strategy.page_content` requests. We almost never want to do this but there are a small number of files (e.g., appcasts) hosted on AWS where the response uses a `Content-Encoding: aws-chunked` header instead of the actual encoding (e.g., gzip). This causes a curl error (`curl: (56) Unrecognized content encoding type. libcurl understands deflate, gzip content encodings`) but we can avoid this if we don't request a compressed response. It's not ideal but it's necessary in these cases (and thankfully the files are small).
I forgot to add test cases for the `cookies` and `header` options when I introduced them, so this adds them along with the others.
039df5e to
f22b8e8
Compare
MikeMcQuaid
approved these changes
Jun 16, 2026
MikeMcQuaid
left a comment
Member
There was a problem hiding this comment.
One question, otherwise looks good!
| # set. | ||
| class Options < T::Struct | ||
| # Whether to request a compressed response. | ||
| prop :compressed, T.nilable(T::Boolean) |
Member
There was a problem hiding this comment.
Nilable booleans always feel a bit weird to me. Does this need to be nilable?
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.
brew lgtm(style, typechecking and tests) with your changes locally?This adds a
compressedurloption forlivecheckblocks, so we can selectively omit the curl--compressedargument that we use by default forStrategy.page_contentrequests. We almost never want to do this but there are a small number of files (e.g., appcasts) hosted on AWS where the response uses aContent-Encoding: aws-chunkedheader instead of the actual encoding (e.g., gzip). This causes a curl error (curl: (56) Unrecognized content encoding type. libcurl understands deflate, gzip content encodings) but we can avoid this if we don't request a compressed response. It's not ideal but it's necessary in these cases (and thankfully the files are small).Besides that, I added test cases in
livecheck_spec.rbfor thecookiesandheaderoptions, as I forgot to check the values that are set when I added those options in the past.