diff --git a/Gemfile.lock b/Gemfile.lock index 7d82adc..0a7e016 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - cocoapods-downloader (1.2.2) + cocoapods-downloader (1.2.3) GEM remote: https://rubygems.org/ diff --git a/lib/cocoapods-downloader/gem_version.rb b/lib/cocoapods-downloader/gem_version.rb index 895fa4c..169ee0d 100644 --- a/lib/cocoapods-downloader/gem_version.rb +++ b/lib/cocoapods-downloader/gem_version.rb @@ -3,6 +3,6 @@ module Downloader # @return [String] Downloader’s version, following # [semver](http://semver.org). # - VERSION = '1.2.2'.freeze + VERSION = '1.2.3'.freeze end end diff --git a/lib/cocoapods-downloader/http.rb b/lib/cocoapods-downloader/http.rb index c3a65fc..fcc8249 100644 --- a/lib/cocoapods-downloader/http.rb +++ b/lib/cocoapods-downloader/http.rb @@ -8,7 +8,14 @@ class Http < RemoteFile executable :curl def download_file(full_filename) - curl! '-f', '-L', '-o', full_filename, url, '--create-dirs', '--netrc-optional', '--retry', '2' + parameters = ['-f', '-L', '-v', '-o', full_filename, url, '--create-dirs', '--netrc-optional', '--retry', '2'] + + headers.each do |h| + parameters << '-H' + parameters << h + end unless headers.nil? + + curl! parameters end end end diff --git a/lib/cocoapods-downloader/remote_file.rb b/lib/cocoapods-downloader/remote_file.rb index e4ae88f..2721cc3 100644 --- a/lib/cocoapods-downloader/remote_file.rb +++ b/lib/cocoapods-downloader/remote_file.rb @@ -6,7 +6,7 @@ module Pod module Downloader class RemoteFile < Base def self.options - [:type, :flatten, :sha1, :sha256] + [:type, :flatten, :sha1, :sha256, :headers] end class UnsupportedFileTypeError < StandardError; end @@ -35,6 +35,10 @@ def type end end + def headers + options[:headers] + end + # @note The archive is flattened if it contains only one folder and its # extension is either `tgz`, `tar`, `tbz` or the options specify # it.