Skip to content

livecheck: add compressed option#22757

Open
samford wants to merge 2 commits into
mainfrom
livecheck/add-compressed-option
Open

livecheck: add compressed option#22757
samford wants to merge 2 commits into
mainfrom
livecheck/add-compressed-option

Conversation

@samford

@samford samford commented Jun 15, 2026

Copy link
Copy Markdown
Member

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them? Performance claims (e.g. "this is faster") must include Hyperfine benchmarks.
  • Have you written new tests (excluding integration tests) for your changes? Here's an example.
  • Have you successfully run brew lgtm (style, typechecking and tests) with your changes locally?

  • AI was used to generate or assist with generating this PR.

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).

Besides that, I added test cases in livecheck_spec.rb for the cookies and header options, as I forgot to check the values that are set when I added those options in the past.

Copilot AI review requested due to automatic review settings June 15, 2026 21:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 compressed to Livecheck::Options and the livecheck url DSL, and use it to control whether Strategy.page_content appends --compressed.
  • Update option equality/url-options serialization to include compressed.
  • Add/extend specs for compressed, cookies, and header option 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.

Comment thread Library/Homebrew/test/livecheck/strategy_spec.rb Outdated
samford added 2 commits June 15, 2026 17:49
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.
@samford samford force-pushed the livecheck/add-compressed-option branch from 039df5e to f22b8e8 Compare June 15, 2026 21:50

@MikeMcQuaid MikeMcQuaid left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One question, otherwise looks good!

# set.
class Options < T::Struct
# Whether to request a compressed response.
prop :compressed, T.nilable(T::Boolean)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nilable booleans always feel a bit weird to me. Does this need to be nilable?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants