Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
iMacTia committed Dec 23, 2020
1 parent 3278e9d commit e284370
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Expand Up @@ -12,7 +12,7 @@ GEM
crack (0.4.4)
diff-lcs (1.4.4)
docile (1.3.2)
faraday (1.1.0)
faraday (1.2.0)
multipart-post (>= 1.2, < 3)
ruby2_keywords
hashdiff (1.0.1)
Expand Down
15 changes: 8 additions & 7 deletions lib/faraday/adapter/net_http.rb
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

0 comments on commit e284370

Please sign in to comment.