Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Porting fix for Net::HTTP env proxy (Faraday #1221) #2

Merged
merged 5 commits into from
Dec 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ spec/reports/
tmp/

*.gem
gemfile.lock

.rvmrc
.ruby-version

.rspec_status
.rspec_status
2 changes: 0 additions & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ Metrics/BlockLength:
Exclude:
- spec/**/*.rb
- examples/**/*.rb
Metrics/ClassLength:
Enabled: false
Metrics/AbcSize:
Max: 67
Metrics/ClassLength:
Expand Down
6 changes: 0 additions & 6 deletions .travis.yml

This file was deleted.

87 changes: 0 additions & 87 deletions Gemfile.lock

This file was deleted.

15 changes: 8 additions & 7 deletions lib/faraday/adapter/net_http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,15 @@ def build_connection(env)
end

def net_http_connection(env)
klass = if (proxy = env[:request][:proxy])
Net::HTTP::Proxy(proxy[:uri].hostname, proxy[:uri].port,
proxy[:user], proxy[:password])
else
Net::HTTP
end
proxy = env[:request][:proxy]
port = env[:url].port || (env[:url].scheme == 'https' ? 443 : 80)
klass.new(env[:url].hostname, port)
if proxy
Net::HTTP.new(env[:url].hostname, port,
proxy[:uri].hostname, proxy[:uri].port,
proxy[:user], proxy[:password])
else
Net::HTTP.new(env[:url].hostname, port, nil)
end
end

def call(env)
Expand Down