Stop unnecessarily dumping headers
This commit is contained in:
parent
a156621297
commit
86bce7bf1d
@ -122,7 +122,7 @@ module Utils
|
|||||||
return {} unless headers
|
return {} unless headers
|
||||||
|
|
||||||
# Skip status code
|
# Skip status code
|
||||||
headers.split("\r\n")[2..].to_h { |h| h.split(": ") }
|
headers.split("\r\n")[1..].to_h { |h| h.split(": ") }
|
||||||
end
|
end
|
||||||
|
|
||||||
def curl_download(*args, to: nil, try_partial: true, **options)
|
def curl_download(*args, to: nil, try_partial: true, **options)
|
||||||
@ -130,8 +130,7 @@ module Utils
|
|||||||
destination.dirname.mkpath
|
destination.dirname.mkpath
|
||||||
|
|
||||||
if try_partial
|
if try_partial
|
||||||
range_stdout = curl_output("--location", "--dump-header", "-",
|
range_stdout = curl_output("--location", "--head", *args, **options).stdout
|
||||||
"--head", *args, **options).stdout
|
|
||||||
headers = parse_headers(range_stdout.split("\r\n\r\n").first)
|
headers = parse_headers(range_stdout.split("\r\n\r\n").first)
|
||||||
|
|
||||||
# Any value for `accept-ranges` other than none indicates that the server supports partial requests.
|
# Any value for `accept-ranges` other than none indicates that the server supports partial requests.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user