Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Download does not start immediately, a lot of network traffic (file is downloaded twice?) #18213

Closed
3 tasks done
marcel-idana opened this issue Aug 30, 2024 · 13 comments
Closed
3 tasks done
Labels
bug Reproducible Homebrew/brew bug help wanted We want help addressing this

Comments

@marcel-idana
Copy link

marcel-idana commented Aug 30, 2024

brew doctor output

Your system is ready to brew.

Verification

  • My "brew doctor output" above says Your system is ready to brew. and am still able to reproduce my issue.
  • I ran brew update twice and am still able to reproduce my issue.
  • This issue's title and/or description do not reference a single formula e.g. brew install wget. If they do, open an issue at https://github.com/Homebrew/homebrew-core/issues/new/choose instead.

brew config output

HOMEBREW_VERSION: 4.3.18
ORIGIN: https://github.com/Homebrew/brew
HEAD: abc0584215659c5a8716d0798ea2801388d01368
Last commit: 5 days ago
Core tap JSON: 30 Aug 22:32 UTC
Core cask tap JSON: 30 Aug 22:32 UTC
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_EDITOR: nano
HOMEBREW_MAKE_JOBS: 12
Homebrew Ruby: 3.3.4 => /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/bin/ruby
CPU: dodeca-core 64-bit arm_blizzard_avalanche
Clang: 15.0.0 build 1500
Git: 2.46.0 => /opt/homebrew/bin/git
Curl: 8.7.1 => /usr/bin/curl
macOS: 14.6.1-arm64
CLT: 15.3.0.0.1.1708646388
Xcode: N/A
Rosetta 2: false

What were you trying to do (and why)?

Install any homebrew cask. For example rsudio:

brew install --cask rstudio --verbose --debug

This occurred also with appcleaner, webstorm, goland and more casks.

What happened (include all command output)?

Installing a cask takes a lot of time, the download bar is not shown immediately and the installation causes a lot of network traffic. Maybe issue 10528 is related? Also maybe I have some odd OS state that triggers this.

In the shown output below a long pause with network activity occurs. ### LONG PAUSE WITH NETWORK ACTIVITY ### is not part of the output was inserted by me.

.
.
.
/usr/bin/env /opt/homebrew/Library/Homebrew/shims/shared/curl --disable --cookie /dev/null --globoff --show-error --user-agent Homebrew/4.3.18\ \(Macintosh\;\ arm64\ Mac\ OS\ X\ 14.6.1\)\ curl/8.7.1 --header Accept-Language:\ en --retry 3 --fail --location --silent --head --request GET https://download1.rstudio.org/electron/macos/RStudio-2024.04.2-764.dmg
### LONG PAUSE WITH NETWORK ACTIVITY ###
==> Downloading https://download1.rstudio.org/electron/macos/RStudio-2024.04.2-764.dmg
.
.
.

Full unmodified output:

/opt/homebrew/Library/Homebrew/brew.rb (Cask::CaskLoader::FromAPILoader): loading rstudio
==> Cask::Installer#install
/opt/homebrew/Library/Homebrew/brew.rb (Cask::CaskLoader::FromAPILoader): loading rstudio@daily
==> Printing caveats
==> Caveats
rstudio depends on R. The R Project provides official binaries:

  brew install --cask r

Alternatively, the Homebrew-compiled version of R omits the GUI app:

  brew install r

==> Cask::Installer#fetch
/usr/bin/env /opt/homebrew/Library/Homebrew/shims/shared/curl --disable --cookie /dev/null --globoff --show-error --user-agent Homebrew/4.3.18\ \(Macintosh\;\ arm64\ Mac\ OS\ X\ 14.6.1\)\ curl/8.7.1 --header Accept-Language:\ en --retry 3 --fail --location --silent --head https://download1.rstudio.org/electron/macos/RStudio-2024.04.2-764.dmg
/usr/bin/env /opt/homebrew/Library/Homebrew/shims/shared/curl --disable --cookie /dev/null --globoff --show-error --user-agent Homebrew/4.3.18\ \(Macintosh\;\ arm64\ Mac\ OS\ X\ 14.6.1\)\ curl/8.7.1 --header Accept-Language:\ en --retry 3 --fail --location --silent --head --request GET https://download1.rstudio.org/electron/macos/RStudio-2024.04.2-764.dmg
==> Downloading https://download1.rstudio.org/electron/macos/RStudio-2024.04.2-764.dmg
/usr/bin/env /opt/homebrew/Library/Homebrew/shims/shared/curl --disable --cookie /dev/null --globoff --show-error --user-agent Homebrew/4.3.18\ \(Macintosh\;\ arm64\ Mac\ OS\ X\ 14.6.1\)\ curl/8.7.1 --header Accept-Language:\ en --fail --retry 3 --remote-time --output /Users/marcel-idana/Library/Caches/Homebrew/downloads/f7312e36afbfbb0468f24fd43c24192ac61e0fc1d8c72ddac3a67d182190ab15--RStudio-2024.04.2-764.dmg.incomplete --location https://download1.rstudio.org/electron/macos/RStudio-2024.04.2-764.dmg
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  633M  100  633M    0     0  4781k      0  0:02:15  0:02:15 --:--:-- 8639k
==> Checking quarantine support
/usr/bin/env /usr/bin/xattr -h
/usr/bin/env /Library/Developer/CommandLineTools/usr/bin/swift -target arm64-apple-macosx14 /opt/homebrew/Library/Homebrew/cask/utils/quarantine.swift
==> Quarantine is available.
==> Verifying Gatekeeper status of /Users/marcel-idana/Library/Caches/Homebrew/downloads/f7312e36afbfbb0468f24fd43c24192ac61e0fc1d8c72ddac3a67d182190ab15--RStudio-2024.04.2-764.dmg
/usr/bin/env /usr/bin/xattr -p com.apple.quarantine /Users/marcel-idana/Library/Caches/Homebrew/downloads/f7312e36afbfbb0468f24fd43c24192ac61e0fc1d8c72ddac3a67d182190ab15--RStudio-2024.04.2-764.dmg
==> /Users/marcel-idana/Library/Caches/Homebrew/downloads/f7312e36afbfbb0468f24fd43c24192ac61e0fc1d8c72ddac3a67d182190ab15--RStudio-2024.04.2-764.dmg is not quarantined
==> Quarantining /Users/marcel-idana/Library/Caches/Homebrew/downloads/f7312e36afbfbb0468f24fd43c24192ac61e0fc1d8c72ddac3a67d182190ab15--RStudio-2024.04.2-764.dmg
/usr/bin/env /Library/Developer/CommandLineTools/usr/bin/swift -target arm64-apple-macosx14 /opt/homebrew/Library/Homebrew/cask/utils/quarantine.swift /Users/marcel-idana/Library/Caches/Homebrew/downloads/f7312e36afbfbb0468f24fd43c24192ac61e0fc1d8c72ddac3a67d182190ab15--RStudio-2024.04.2-764.dmg https://download1.rstudio.org/electron/macos/RStudio-2024.04.2-764.dmg https://posit.co/products/open-source/rstudio/
==> Verifying checksum for 'f7312e36afbfbb0468f24fd43c24192ac61e0fc1d8c72ddac3a67d182190ab15--RStudio-2024.04.2-764.dmg'
/usr/bin/env hdiutil imageinfo -format /Users/marcel-idana/Library/Caches/Homebrew/downloads/f7312e36afbfbb0468f24fd43c24192ac61e0fc1d8c72ddac3a67d182190ab15--RStudio-2024.04.2-764.dmg
==> Installing Cask rstudio
==> Cask::Installer#stage
==> Extracting primary container
==> Using container class UnpackStrategy::Dmg for /Users/marcel-idana/Library/Caches/Homebrew/downloads/f7312e36afbfbb0468f24fd43c24192ac61e0fc1d8c72ddac3a67d182190ab15--RStudio-2024.04.2-764.dmg
/usr/bin/env hdiutil attach -plist -nobrowse -readonly -mountrandom /private/tmp/homebrew-dmg20240831-74270-a6qqrj /Users/marcel-idana/Library/Caches/Homebrew/downloads/f7312e36afbfbb0468f24fd43c24192ac61e0fc1d8c72ddac3a67d182190ab15--RStudio-2024.04.2-764.dmg
/usr/bin/env find . -print0
/usr/bin/env mkbom -s -i /private/tmp/20240831-74270-v561h8.list -- /private/tmp/20240831-74270-4cmry6.bom
/usr/bin/env ditto --bom /private/tmp/20240831-74270-4cmry6.bom -- /private/tmp/homebrew-dmg20240831-74270-a6qqrj/dmg.aBXMuD /private/tmp/homebrew-unpack20240831-74270-aotcow
/usr/bin/env diskutil info -plist /private/tmp/homebrew-dmg20240831-74270-a6qqrj/dmg.aBXMuD
/usr/bin/env diskutil eject disk6s1
/usr/bin/env cp -pR /private/tmp/homebrew-unpack20240831-74270-aotcow/RStudio.app/. /opt/homebrew/Caskroom/rstudio/2024.04.2,764/RStudio.app
==> Verifying Gatekeeper status of /Users/marcel-idana/Library/Caches/Homebrew/downloads/f7312e36afbfbb0468f24fd43c24192ac61e0fc1d8c72ddac3a67d182190ab15--RStudio-2024.04.2-764.dmg
/usr/bin/env /usr/bin/xattr -p com.apple.quarantine /Users/marcel-idana/Library/Caches/Homebrew/downloads/f7312e36afbfbb0468f24fd43c24192ac61e0fc1d8c72ddac3a67d182190ab15--RStudio-2024.04.2-764.dmg
==> /Users/marcel-idana/Library/Caches/Homebrew/downloads/f7312e36afbfbb0468f24fd43c24192ac61e0fc1d8c72ddac3a67d182190ab15--RStudio-2024.04.2-764.dmg is quarantined
==> Propagating quarantine from /Users/marcel-idana/Library/Caches/Homebrew/downloads/f7312e36afbfbb0468f24fd43c24192ac61e0fc1d8c72ddac3a67d182190ab15--RStudio-2024.04.2-764.dmg to /opt/homebrew/Caskroom/rstudio/2024.04.2,764
/usr/bin/env /usr/bin/xattr -p com.apple.quarantine /Users/marcel-idana/Library/Caches/Homebrew/downloads/f7312e36afbfbb0468f24fd43c24192ac61e0fc1d8c72ddac3a67d182190ab15--RStudio-2024.04.2-764.dmg
/usr/bin/env /usr/bin/xargs -0 -- /bin/chmod -h u+w
/usr/bin/env /usr/bin/xargs -0 -- /usr/bin/xattr -w com.apple.quarantine 0381\;66d249c5\;\;F8F482A8-F919-4D20-8531-B4F232B834CD
==> Creating metadata directory: /opt/homebrew/Caskroom/rstudio/.metadata/2024.04.2,764/20240830223820.469
==> Creating metadata subdirectory: /opt/homebrew/Caskroom/rstudio/.metadata/2024.04.2,764/20240830223820.469/Casks
==> Installing artifacts
==> Installing artifact of class Cask::Artifact::App
==> Moving App 'RStudio.app' to '/Applications/RStudio.app'
🍺  rstudio was successfully installed!

What did you expect to happen?

Cask installation takes less time and the download bar is shown immediately.

Step-by-step reproduction instructions (by running brew commands)

brew install --cask rstudio --verbose --debug
@marcel-idana marcel-idana added the bug Reproducible Homebrew/brew bug label Aug 30, 2024
@Homebrew Homebrew deleted a comment Aug 31, 2024
@MikeMcQuaid
Copy link
Member

@marcel-idana Do you have a proxy/VPN? Does brew fetch exhibit the same behaviour? Do you see this on most casks or just the ones mentioned? Any formulae? Thanks!

@marcel-idana
Copy link
Author

Thanks for your quick response!

Weeks ago I tried to download files with curl with a proxy. But I only used command line flags. My .curlrc is empty and environment variables http_proxy and https_proxy are unset. Also no enabled proxy settings found in macOS.

I have two user accounts on my machine and changed user permissions with sudo chown -R $(whoami) /opt/homebrew to use Homebrew not with the account that installed Homebrew.

It also happen with the casks firefox and chromium.

brew fetch has the same behaviour.

Also the non cask formulae rust (brew install rust) behaves like this.

I also reinstalled Homebrew with no result.

I still believe that my OS is in some odd state and i would be sorry if i wasted your time ✌🏼

@cho-m
Copy link
Member

cho-m commented Sep 2, 2024

I think this happens when upstream has no content-disposition header. This causes brew to fallback on HTTP GET to verify this information which doesn't get cached:

[[], ["--request", "GET"]].each do |request_args|

Thus, essentially a double download.

For example, in top 5 casks:

  1. visual-studio-code - content-disposition: attachment; filename=VSCode-darwin-arm64.zip; filename*=UTF-8''VSCode-darwin-arm64.zip
  2. iterm2 - no
  3. android-commandlinetools - content-disposition: attachment
  4. docker - no
  5. google-chrome - content-disposition: attachment

So far, only Microsoft and Google software.


Anyway, should try to at least cache the GET to get ~2x speed up (maybe slightly less if any non-brew cache speeds up 2nd download).

@MikeMcQuaid MikeMcQuaid added the help wanted We want help addressing this label Sep 3, 2024
@tdtgit
Copy link

tdtgit commented Sep 6, 2024

I also have same issue for some specific package, like microsoft-edge. It take a while, maybe more 30s, from Upgrading... to Downloading...

image

@xkia
Copy link

xkia commented Sep 13, 2024

I also encountered a similar issue, through network monitoring, there is download traffic, but the progress bar takes a very long time to appear, and the progress bar starts from 0.

/usr/bin/env /opt/homebrew/Library/Homebrew/shims/shared/curl --disable --cookie /dev/null --globoff --show-error --user-agent Homebrew/4.3.21\ \(Macintosh\;\ arm64\ Mac\ OS\ X\ 14.6.1\)\ curl/8.7.1 --header Accept-Language:\ en --retry 3 --fail --location --silent --head https://download.calibre-ebook.com/7.18.0/calibre-7.18.0.dmg
/usr/bin/env /opt/homebrew/Library/Homebrew/shims/shared/curl --disable --cookie /dev/null --globoff --show-error --user-agent Homebrew/4.3.21\ \(Macintosh\;\ arm64\ Mac\ OS\ X\ 14.6.1\)\ curl/8.7.1 --header Accept-Language:\ en --retry 3 --fail --location --silent --head --request GET https://download.calibre-ebook.com/7.18.0/calibre-7.18.0.dmg
==> Downloading https://download.calibre-ebook.com/7.18.0/calibre-7.18.0.dmg
/usr/bin/env /opt/homebrew/Library/Homebrew/shims/shared/curl --disable --cookie /dev/null --globoff --show-error --user-agent Homebrew/4.3.21\ \(Macintosh\;\ arm64\ Mac\ OS\ X\ 14.6.1\)\ curl/8.7.1 --header Accept-Language:\ en --retry 3 --fail --location --silent --head --location https://download.calibre-ebook.com/7.18.0/calibre-7.18.0.dmg
/usr/bin/env /opt/homebrew/Library/Homebrew/shims/shared/curl --disable --cookie /dev/null --globoff --show-error --user-agent Homebrew/4.3.21\ \(Macintosh\;\ arm64\ Mac\ OS\ X\ 14.6.1\)\ curl/8.7.1 --header Accept-Language:\ en --fail --progress-bar --retry 3 --remote-time --output /Users/user/Library/Caches/Homebrew/downloads/38f63421d13e4582a2acb67634a1b892eb1eb16a551788e05deddf0ed5bf72d6--calibre-7.18.0.dmg.incomplete --continue-at - --location https://download.calibre-ebook.com/7.18.0/calibre-7.18.0.dmg

@cho-m
Copy link
Member

cho-m commented Oct 4, 2024

Taking another look at issue, the behavior may actually be a bug in macOS curl. Maybe specific to 8.7.1 but haven't had chance to look upstream or try with older versions.

Specifically when using --head with --request GET, system curl seems to fetch download while latest brew curl fetches headers

Using iTerm2 as an example:

hyperfine '/usr/bin/curl --head --request GET https://iterm2.com/downloads/stable/iTerm2-3_5_5.zip' '/opt/homebrew/opt/curl/bin/curl --head --request GET https://iterm2.com/downloads/stable/iTerm2-3_5_5.zip'
Benchmark 1: /usr/bin/curl --head --request GET https://iterm2.com/downloads/stable/iTerm2-3_5_5.zip
  Time (mean ± σ):      2.043 s ±  0.283 s    [User: 0.198 s, System: 0.054 s]
  Range (min … max):    1.718 s …  2.546 s    10 runs

Benchmark 2: /opt/homebrew/opt/curl/bin/curl --head --request GET https://iterm2.com/downloads/stable/iTerm2-3_5_5.zip
  Time (mean ± σ):      97.7 ms ±  36.4 ms    [User: 14.3 ms, System: 5.6 ms]
  Range (min … max):    81.1 ms … 279.0 ms    28 runs

  Warning: Statistical outliers were detected. Consider re-running this benchmark on a quiet system without any interferences from other programs. It might help to use the '--warmup' or '--prepare' options.

Summary
  /opt/homebrew/opt/curl/bin/curl --head --request GET https://iterm2.com/downloads/stable/iTerm2-3_5_5.zip ran
   20.92 ± 8.31 times faster than /usr/bin/curl --head --request GET https://iterm2.com/downloads/stable/iTerm2-3_5_5.zip

@stolendata
Copy link

stolendata commented Oct 5, 2024

Just want to chime in and confirm that I, too, can see in my web server logs that brew downloads cask payloads twice when installing/upgrading. Log excerpt:

x.x.x.x - - [05/Oct/2024:12:11:56 +0200] "HEAD /~djinn/mpv_osx/mpv-arm64-0.39.0.tar.gz HTTP/2.0" 200 0 "-" "Homebrew/4.4.0 (Macintosh; arm64 Mac OS X 14.6.1) curl/8.7.1"
x.x.x.x - - [05/Oct/2024:12:12:10 +0200] "GET /~djinn/mpv_osx/mpv-arm64-0.39.0.tar.gz HTTP/2.0" 200 21575403 "-" "Homebrew/4.4.0 (Macintosh; arm64 Mac OS X 14.6.1) curl/8.7.1"
x.x.x.x - - [05/Oct/2024:12:12:26 +0200] "GET /~djinn/mpv_osx/mpv-arm64-0.39.0.tar.gz HTTP/2.0" 200 21575403 "-" "Homebrew/4.4.0 (Macintosh; arm64 Mac OS X 14.6.1) curl/8.7.1"

y.y.y.y - - [05/Oct/2024:12:39:35 +0200] "HEAD /~djinn/mpv_osx/mpv-0.39.0.tar.gz HTTP/2.0" 200 0 "-" "Homebrew/4.4.0 (Macintosh; Intel Mac OS X 15.0.1) curl/8.7.1"
y.y.y.y - - [05/Oct/2024:12:39:41 +0200] "GET /~djinn/mpv_osx/mpv-0.39.0.tar.gz HTTP/2.0" 200 23791174 "-" "Homebrew/4.4.0 (Macintosh; Intel Mac OS X 15.0.1) curl/8.7.1"
y.y.y.y - - [05/Oct/2024:12:39:48 +0200] "GET /~djinn/mpv_osx/mpv-0.39.0.tar.gz HTTP/2.0" 200 23791174 "-" "Homebrew/4.4.0 (Macintosh; Intel Mac OS X 15.0.1) curl/8.7.1"

z.z.z.z - - [05/Oct/2024:12:47:00 +0200] "HEAD /~djinn/mpv_osx/mpv-arm64-0.39.0.tar.gz HTTP/2.0" 200 0 "-" "Homebrew/4.4.0 (Macintosh; arm64 Mac OS X 15.0.1) curl/8.7.1"
z.z.z.z - - [05/Oct/2024:12:47:07 +0200] "GET /~djinn/mpv_osx/mpv-arm64-0.39.0.tar.gz HTTP/2.0" 200 21575403 "-" "Homebrew/4.4.0 (Macintosh; arm64 Mac OS X 15.0.1) curl/8.7.1"
z.z.z.z - - [05/Oct/2024:12:47:15 +0200] "GET /~djinn/mpv_osx/mpv-arm64-0.39.0.tar.gz HTTP/2.0" 200 21575403 "-" "Homebrew/4.4.0 (Macintosh; arm64 Mac OS X 15.0.1) curl/8.7.1"

Taking another look at issue, the behavior may actually be a bug in macOS curl. Maybe specific to 8.7.1 but haven't had chance to look upstream or try with older versions.

@cho-m In my logs I see it happening with multiple curl versions as far back as 7.64.1 on Catalina.

@cho-m
Copy link
Member

cho-m commented Oct 5, 2024

@cho-m In my logs I see it happening with multiple curl versions as far back as 7.64.1 on Catalina.

Thanks for the information. I only tested 8.6.0 thru 8.10.1. The ones that I saw behavior were curl 8.7.1 - 8.9.0.

However, curl 8.6.0 would return the "weird" reply which I think is related to https://curl.se/mail/lib-2024-02/0000.html. Given this was a regression, it may be that <=8.5.0 behaved like 8.7.1.


May need either @reitermarkus or @samford for context on original fallback scenario - #15117

I was experimenting with skipping fallback in #18508 on the download code path.

Livecheck code path still needs it but it has a chance of timing out as it slows down the operation, e.g.

hyperfine 'brew livecheck catlight' 'HOMEBREW_FORCE_BREWED_CURL=1 brew livecheck catlight'
Benchmark 1: brew livecheck catlight
  Time (mean ± σ):     10.250 s ±  0.339 s    [User: 2.270 s, System: 0.608 s]
  Range (min … max):    9.622 s … 10.648 s    10 runs

Benchmark 2: HOMEBREW_FORCE_BREWED_CURL=1 brew livecheck catlight
  Time (mean ± σ):      2.085 s ±  0.304 s    [User: 0.658 s, System: 0.185 s]
  Range (min … max):    1.838 s …  2.803 s    10 runs

Summary
  HOMEBREW_FORCE_BREWED_CURL=1 brew livecheck catlight ran
    4.92 ± 0.74 times faster than brew livecheck catlight

cho-m added a commit that referenced this issue Oct 5, 2024
The `curl --head --request GET` causes a full download to happen on
`curl` prior to 8.10.0[^1] (ignoring `curl` 8.6.0 which returned a
"Weird server reply" due to a bug[^2]) which causes poor UX due to slow
Cask downloads that can take almost twice as long as it should.

[^1]: #18213
[^2]: https://curl.se/mail/lib-2024-02/0000.html
@cho-m
Copy link
Member

cho-m commented Oct 5, 2024

The 8.10.0 fix was curl/curl@29610e5

@cho-m
Copy link
Member

cho-m commented Oct 5, 2024

x.x.x.x - - [05/Oct/2024:12:11:56 +0200] "HEAD /~djinn/mpv_osx/mpv-arm64-0.39.0.tar.gz HTTP/2.0" 200 0 "-" "Homebrew/4.4.0 (Macintosh; arm64 Mac OS X 14.6.1) curl/8.7.1"
x.x.x.x - - [05/Oct/2024:12:12:10 +0200] "GET /~djinn/mpv_osx/mpv-arm64-0.39.0.tar.gz HTTP/2.0" 200 21575403 "-" "Homebrew/4.4.0 (Macintosh; arm64 Mac OS X 14.6.1) curl/8.7.1"
x.x.x.x - - [05/Oct/2024:12:12:26 +0200] "GET /~djinn/mpv_osx/mpv-arm64-0.39.0.tar.gz HTTP/2.0" 200 21575403 "-" "Homebrew/4.4.0 (Macintosh; arm64 Mac OS X 14.6.1) curl/8.7.1"

Noting that 3 requests are expected, i.e.

  1. HEAD request
  2. Fallback to HEAD request with GET method
  3. Finally actual download GET request.

In theory, the first 2 should be quick as only getting headers.

We've confirmed no issue with curl 8.4.0 (#18508 (comment)) and I've tested 8.5.0 with no issue, so the impacted curl versions are probably still 8.7.0 - 8.9.0.

@stolendata
Copy link

stolendata commented Oct 5, 2024

Noting that 3 requests are expected, i.e.

1. HEAD request

2. Fallback to HEAD request with GET method

3. Finally actual download GET request.

Is the point of the HEAD request to get information on the payload presence, size, etc.? If so, how about adding --range 0-0 for the second/fallback attempt? It will produce the same type of response (i.e. only headers) and additionally provide data on the total size of the file.

In my experience practically every httpd out there supports the Range/Byte-Range header these days.

cho-m added a commit that referenced this issue Oct 5, 2024
The `curl --head --request GET` causes a full download to happen on
`curl` from 8.7.0 to 8.9.1[^1] which causes poor UX due to slow
Cask downloads that can take almost twice as long as they should.

[^1]: #18213
@cho-m
Copy link
Member

cho-m commented Oct 5, 2024

The requests are for content-disposition which seems to be necessary for some downloads (e.g. S3 redirect?). It looks like users hit issues with this when we tried removing fallback - #15089 (comment).

Sadly without exact examples, it is hard to tell what works/breaks.

For now, experimenting with downgrade to --http1.1 which is a common workaround we already use.

cho-m added a commit that referenced this issue Oct 5, 2024
The `curl --head --request GET` causes a full download to happen on
`curl` from 8.7.0 to 8.9.1[^1] which causes poor UX due to slow
Cask downloads that can take almost twice as long as they should.

[^1]: #18213
@cho-m
Copy link
Member

cho-m commented Oct 8, 2024

Workaround has been merged. If on stable brew, then will probably be available whenever 4.4.1 is released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Reproducible Homebrew/brew bug help wanted We want help addressing this
Projects
None yet
Development

No branches or pull requests

6 participants