From b9b917756c6408f20a341fe47fe0385d067f14d1 Mon Sep 17 00:00:00 2001 From: cnnrmnn Date: Thu, 13 May 2021 11:42:28 -0400 Subject: [PATCH] Add header parsing --- Library/Homebrew/utils/curl.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Library/Homebrew/utils/curl.rb b/Library/Homebrew/utils/curl.rb index 67a5630747..30726f0ab2 100644 --- a/Library/Homebrew/utils/curl.rb +++ b/Library/Homebrew/utils/curl.rb @@ -118,6 +118,13 @@ module Utils result end + def parse_headers(headers) + headers.split("\n").to_h do |h| + partitioned = h.partition(": ") + [partitioned.first, partitioned.last] + end + end + def curl_download(*args, to: nil, try_partial: true, **options) destination = Pathname(to) destination.dirname.mkpath