google / ripunzip

Other
161 stars 17 forks source link

Ability to force range requests and/or clever detection when range is supported #57

Open robherley opened 10 months ago

robherley commented 10 months ago

πŸ‘‹ First off, this is a really neat utility!

I was testing this with a remote zip on Azure Blob that had a bunch of files in it.

I noticed that the range requests were not detected on the URL I was using:

$ ripunzip unzip-uri -v https://robstorage123.blob.core.windows.net/test/node_modules-v4.zip                                                                      

[2023-12-11T22:25:49Z WARN  ripunzip::unzip] HTTP(S) server does not support range requests - falling back to fetching whole file.

However Azure does support it, it just doesn't advertise Accept-Ranges:

$ curl --header "Range: bytes=0-0" -I https://robstorage123.blob.core.windows.net/test/node_modules-v4.zip
HTTP/1.1 200 OK
Content-Length: 7272289
Content-Type: application/zip
Content-MD5: EaCo5mkj/mtghpXLHQffgQ==
Last-Modified: Sat, 09 Dec 2023 21:17:48 GMT
ETag: 0x8DBF8FC4B60E2E7
Server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
x-ms-request-id: 66720a04-101e-0027-4402-2ef73a000000
x-ms-version: 2009-09-19
x-ms-lease-status: unlocked
x-ms-blob-type: BlockBlob
Date: Wed, 13 Dec 2023 20:28:24 GMT

Would it be possible to have an option to force a range request? Or perhaps doing a zero byte range head request on the target URL?

adetaylor commented 1 month ago

I'd be happy to accept a pull request to add that option! (The zero byte range request is a cunning idea - I'd be fine with that too).