faraday-net_http 0.0.5 → 2.0.0.alpha.pre.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1013f1c809b1d5d0f3852af8ffd6b598e144600b3c6dde6210ed06dd73e247cc
4
- data.tar.gz: 94d5d5203458905c69d3a14773a76e29831799097ada86e2952a1ee4de81bb70
3
+ metadata.gz: f906e027c9d891ccc21f9a1b750e1cb917d56315d8661d7a1a4278eb18ff1084
4
+ data.tar.gz: 4cd64aad7008c122cbcaae48bfcb4b61c6387557552c5a5405981cd0b70389be
5
5
  SHA512:
6
- metadata.gz: 61654e5b5332e37cd1cca36999c08ed314acfb693030f950b9c2ffec687cbf796e7602bafbdf743ef3c8f38e396bb92767083a24436d73cacc22b8763ab415eb
7
- data.tar.gz: bd432a059127978db61a14791355bbfe5afb1f7ac5e5ebac0c3bdc76b447198d2bf77998a4e9a4e091b51d1471c29354985f20444256a9fb1b526d311c9f74af
6
+ metadata.gz: '0793967f3175c622bc15b797124a857f6ddc56eb8284e37dae9fe8bb643061bc160793a1f925e2654b309e87fd8badae5a557bcf2a1260a4fa4c1ed0c9f50367'
7
+ data.tar.gz: 8d44d2ca498d7f0f1cd3903b56f673f8c8d13648871c5b298d0cfca8ab99d191fbb2dbb904803450b48724c4c77a533791e835247f8cca8c880a4b0f903d4a40
@@ -9,10 +9,8 @@ rescue LoadError
9
9
  end
10
10
  require 'zlib'
11
11
 
12
- # rubocop:disable Metrics/ClassLength
13
12
  module Faraday
14
13
  class Adapter
15
- # Net::HTTP adapter.
16
14
  class NetHttp < Faraday::Adapter
17
15
  exceptions = [
18
16
  IOError,
@@ -50,24 +48,27 @@ module Faraday
50
48
  end
51
49
 
52
50
  def net_http_connection(env)
53
- klass = if (proxy = env[:request][:proxy])
54
- Net::HTTP::Proxy(proxy[:uri].hostname, proxy[:uri].port,
55
- proxy[:user], proxy[:password])
56
- else
57
- Net::HTTP
58
- end
51
+ proxy = env[:request][:proxy]
59
52
  port = env[:url].port || (env[:url].scheme == 'https' ? 443 : 80)
60
- klass.new(env[:url].hostname, port)
53
+ if proxy
54
+ Net::HTTP.new(env[:url].hostname, port,
55
+ proxy[:uri].hostname, proxy[:uri].port,
56
+ proxy[:user], proxy[:password])
57
+ else
58
+ Net::HTTP.new(env[:url].hostname, port, nil)
59
+ end
61
60
  end
62
61
 
63
62
  def call(env)
64
63
  super
65
64
  http_response = connection(env) do |http|
66
- perform_request(http, env)
67
- rescue *NET_HTTP_EXCEPTIONS => e
68
- raise Faraday::SSLError, e if defined?(OpenSSL) && e.is_a?(OpenSSL::SSL::SSLError)
65
+ begin
66
+ perform_request(http, env)
67
+ rescue *NET_HTTP_EXCEPTIONS => e
68
+ raise Faraday::SSLError, e if defined?(OpenSSL) && e.is_a?(OpenSSL::SSL::SSLError)
69
69
 
70
- raise Faraday::ConnectionFailed, e
70
+ raise Faraday::ConnectionFailed, e
71
+ end
71
72
  end
72
73
 
73
74
  save_response(env, http_response.code.to_i,
@@ -153,7 +154,6 @@ module Faraday
153
154
  end
154
155
  end
155
156
 
156
- # rubocop:disable Metrics/AbcSize
157
157
  def configure_ssl(http, ssl)
158
158
  return unless ssl
159
159
 
@@ -169,7 +169,6 @@ module Faraday
169
169
  http.min_version = ssl[:min_version] if ssl[:min_version]
170
170
  http.max_version = ssl[:max_version] if ssl[:max_version]
171
171
  end
172
- # rubocop:enable Metrics/AbcSize
173
172
 
174
173
  def configure_request(http, req)
175
174
  if (sec = request_timeout(:read, req))
@@ -212,4 +211,3 @@ module Faraday
212
211
  end
213
212
  end
214
213
  end
215
- # rubocop:enable Metrics/ClassLength
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Faraday
4
4
  module NetHttp
5
- VERSION = '0.0.5'
5
+ VERSION = '2.0.0.alpha-1'
6
6
  end
7
7
  end
@@ -1,10 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'faraday'
4
- require 'faraday/adapter'
5
-
6
- require_relative 'adapter/net_http'
7
- require_relative 'net_http/version'
4
+ require 'faraday/adapter/net_http'
5
+ require 'faraday/net_http/version'
8
6
 
9
7
  module Faraday
10
8
  module NetHttp
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faraday-net_http
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 2.0.0.alpha.pre.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan van der Pas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-23 00:00:00.000000000 Z
11
+ date: 2021-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.0'
20
- type: :development
19
+ version: 2.0.0.alpha.pre.2
20
+ type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.0'
26
+ version: 2.0.0.alpha.pre.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -180,11 +180,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
180
180
  version: 2.4.0
181
181
  required_rubygems_version: !ruby/object:Gem::Requirement
182
182
  requirements:
183
- - - ">="
183
+ - - ">"
184
184
  - !ruby/object:Gem::Version
185
- version: '0'
185
+ version: 1.3.1
186
186
  requirements: []
187
- rubygems_version: 3.1.4
187
+ rubygems_version: 3.1.6
188
188
  signing_key:
189
189
  specification_version: 4
190
190
  summary: Faraday adapter for Net::HTTP