obs-deps icon indicating copy to clipboard operation
obs-deps copied to clipboard

utils.pwsh: Add support for curl resume

Open RytoEX opened this issue 1 year ago • 1 comments

Description

Note that there is a bug in curl that can prevent curl from successfully interpreting a fully downloaded file as completed. The bug was fixed on October 30, 2023 and is not yet available on curl included with Windows.

Fixed in curl 8.5.0. https://github.com/curl/curl/commit/225db9196a71a19132a4c334f256b59854afc70c

Motivation and Context

I noticed that we have the Resume parameter, but that it wasn't implemented. I wanted to implement it to have a way to skip re-downloading a file that was already downloaded. SkipDeps skips build dependencies. SkipUnpack skips git checkouts and archive extraction but not downloads.

Alternatively, we could add something like SkipDownload and implement that, and remove the Resume parameter.

It may be important to note that due to us invoking MSYS2, the copy of curl from there can take precedence in PATH. From my recent tests, MSYS2 curl (8.1.1 on my machine) is older than the one shipped with Windows, so this may not work unless we attempt to fix the curl executable's path to the Windows copy (which should always be at C:\Windows\System32\curl.exe) or locate it and save its path before invoking MSYS2 (with where.exe curl.exe).

How Has This Been Tested?

Tested locally with curl 8.4.0 (what is currently shipped on Windows) to ensure that the code did not currently run.

Types of changes

  • New feature (non-breaking change which adds functionality)

Checklist:

  • [x] My code has been run through clang-format.
  • [x] I have read the contributing document.
  • [x] My code is not on the master branch.
  • [x] The code has been tested.
  • [x] All commit messages are properly formatted and commits squashed where appropriate.
  • [x] I have included updates to all appropriate documentation.

RytoEX avatar Jan 23 '24 23:01 RytoEX

I checked today and currently Windows ships curl 8.7.1. The MSYS2 package via winget has also been updated and ships curl 8.7.1. As such, this would now work if we were interested in merging it.

RytoEX avatar Jul 25 '24 19:07 RytoEX

For posterity, I checked this locally with the qt package, and it seemed to work as expected.

RytoEX avatar Aug 01 '24 16:08 RytoEX