livecheck's `Git` strategy uses `DownloadStrategyDetector#detect`
in its `#match?` method to check if a URL is a Git repository. This
has historically worked fine but I've recently seen a `can't modify
frozen String` error for a few formulae (percona-toolkit,
schroedinger, squid) in relation to the in-place `sub` call in
`BazaarDownloadStrategy`'s initializer.
Other download strategies use a `@url = @url.sub(...)` pattern to
avoid this issue, so this commit resolves the issue by using the same
approach in `BazaarDownloadStrategy`.
Enabling the fsmonitor isn't useful for these repositories. Moreover,
disabling them will get rid of the warning shown from trying to copy
sockets from a repo watched by the fsmonitor.
Some servers erroneously double-quote the filename in the filename*
header. This is (as far as I can tell from the spec) a bug in the
server, and should be fixed there.
In general though using `""` as the filename seems like behaviour worth
handling in brew anyway, as there may be other places where the parser
returns an empty string.
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
Update base URL when there is an absolute location, so that following
relative locations are considered relative to the new base.
Consider below cURL output for https://example_one.com:
HTTP/1.1 302 Moved Temporarily
Location: https://example_two.com
HTTP/1.1 302 Moved Temporarily
Location: /foo/
HTTP/1.1 200 OK
The final URL should be https://example_two.com/foo/ rather than
https://example_one.com/foo/.
Bazaar is no longer maintained, and Breezy seems to be a drop-in
replacement.
I've tested the commands used in the download strategy and they seem to
work.
We need this in order to properly deprecate the `bazaar` formula.
See Homebrew/homebrew-core#106848.
instead of prefixing and/or replacing data in URLs, the
*HOMEBREW_ARTIFACT_DOMAIN* environment variable only replaces
the bottle base URL. this causes URLs from Casks and other assets
to be no longer affected by this feature.
closes#13226closes#13222closes#13227
When its `try_partial` argument is `true`, `#curl_download` makes a
`HEAD` request before downloading the file using `#curl`. Currently
`try_partial` defaults to `true`, so any `#curl_download` call that
doesn't explicitly specify `try_partial: false` will make a `HEAD`
request first. This can potentially involve several requests if the
URL redirects, so it can be a bit of unnecessary overhead when a
partial download isn't needed.
Partial downloads are generally only useful when we're working with
larger files, however there's currently only one place in brew where
`#curl_download` is used and this is the case:
`CurlDownloadStrategy`. The other `#curl_download` calls are fetching
smaller [text] files and don't need to support partial downloads.
This commit changes the default `try_partial` value to `false`,
making partial downloads opt-in rather than opt-out.
We want `try_partial` to continue to default to `true` in
`CurlDownloadStrategy` and there are various ways to accomplish this.
In this commit, I've chosen to update its `#initialize` method to
accept a `try_partial` argument that defaults to `true`, as this
value can also be used in classes that inherit from
`CurlDownloadStrategy` (e.g., `HomebrewCurlDownloadStrategy`). This
instance variable is passed to `#curl_download` in related methods,
effectively maintaining the previous `try_partial: true` value, while
also allowing this value to be overridden when necessary.
Other uses of `#curl_download` in brew are
`Formulary::FromUrlLoader#load_file` and
`Cask::CaskLoader::FromURILoader#load`, which did not provide a
`try_partial` argument but should have been using
`try_partial: false`. With the `try_partial: false` default in this
commit, these calls are now fine without a `try_partial` argument.
The only other use of `#curl_download` in brew is
`SPDX#download_latest_license_data!`. These calls were previously
using `try_partial: false` but we can now omit this argument with
the new `false` default (aligning with the above).