Skip to content

Commit

Permalink
Honor system proxy settings when downloading crashlytics.jar, fix #6765
Browse files Browse the repository at this point in the history
… (#6817)

* Work around ruby defect #12724, where HTTP#get_response and HTTP#post_form don't use ENV proxy settings (#6765)

* fixed code style as per PR guidelines

* added link to ruby defect, changed raise to UI.error! are per reviewers request
  • Loading branch information
timothy-volvo authored and milch committed Nov 2, 2016
1 parent 404ece9 commit 3042878
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions fastlane/lib/fastlane/helper/crashlytics_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,14 @@ def download_android_tools
begin
UI.important("Downloading Crashlytics Support Library - this might take a minute...")

result = Net::HTTP.get(URI(url))
File.write(zip_path, result)
# Work around ruby defect, where HTTP#get_response and HTTP#post_form don't use ENV proxy settings
# https://bugs.ruby-lang.org/issues/12724
uri = URI(url)
http_conn = Net::HTTP.new(uri.host, uri.port)
http_conn.use_ssl = true
result = http_conn.request_get(uri.path)
UI.error! "#{result.message} (#{result.code})" unless result.kind_of? Net::HTTPSuccess
File.write(zip_path, result.body)

# Now unzip the file
Action.sh "unzip '#{zip_path}' -d '#{containing}'"
Expand Down

0 comments on commit 3042878

Please sign in to comment.