faraday-net_http 3.0.2 → 3.3.0

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: 9cad2197cf7df07a668741fb5ae27309b6f7aee396b207268ba63076569ae59f
4
- data.tar.gz: 47fbe72a4c70f85b5659376f0a758088d26c8a6f2901a8320a22bfba872e2c1f
3
+ metadata.gz: 4c53366ebb85cf1ecb84b08ee9df0381e7f0baa4ea812ed54b7b05e331ad46e2
4
+ data.tar.gz: b8240151ee7dd4a35138fb86fc9609d1d18d624c7682ed0ced50cdb714006280
5
5
  SHA512:
6
- metadata.gz: 7b6cb45789018beedcef079c136c213e6532aba87d2503bd6f1544cf30f3ab3cdda9c08e4164d0f93a056595622cdf9c8f125e19798f8147e3e52f1387c5c800
7
- data.tar.gz: 66131665eb559ad8b1bbba18c12916c3ace677b93a6055269c7def945dced9021f2864df22d9326880a8379602e0ac78fd44f49c137217e05978fa7377cedb3d
6
+ metadata.gz: e89150856172fccf9299b9070d44b54d0d2df69ca712d74e841ddf87c372045af3bc6d89e9c591884032011fe3a2aae94caff0ff1462ac104210c3c6b3a566fb
7
+ data.tar.gz: a0e6103eeb6da0f208a3760ef63dc0c5d72d0b201803bfc8f3e5815fdd99d614a45ae6aefb2dd07a7a74245c4783c2e92fa15b63f71ba812b7ee6495ff8d1c5b
@@ -42,8 +42,7 @@ module Faraday
42
42
 
43
43
  def build_connection(env)
44
44
  net_http_connection(env).tap do |http|
45
- http.use_ssl = env[:url].scheme == 'https' if http.respond_to?(:use_ssl=)
46
- configure_ssl(http, env[:ssl])
45
+ configure_ssl(http, env[:ssl]) if env[:url].scheme == 'https' && env[:ssl]
47
46
  configure_request(http, env[:request])
48
47
  end
49
48
  end
@@ -106,18 +105,14 @@ module Faraday
106
105
  http_response
107
106
  end
108
107
 
109
- def request_with_wrapped_block(http, env)
108
+ def request_with_wrapped_block(http, env, &block)
110
109
  # Must use Net::HTTP#start and pass it a block otherwise the server's
111
110
  # TCP socket does not close correctly.
112
111
  http.start do |opened_http|
113
112
  opened_http.request create_request(env) do |response|
114
113
  save_http_response(env, response)
115
114
 
116
- if block_given?
117
- response.read_body do |chunk|
118
- yield(chunk)
119
- end
120
- end
115
+ response.read_body(&block) if block_given?
121
116
  end
122
117
  end
123
118
  end
@@ -133,12 +128,15 @@ module Faraday
133
128
  end
134
129
 
135
130
  def configure_ssl(http, ssl)
136
- return unless ssl
131
+ http.use_ssl = true if http.respond_to?(:use_ssl=)
137
132
 
138
133
  http.verify_mode = ssl_verify_mode(ssl)
139
134
  http.cert_store = ssl_cert_store(ssl)
140
135
 
141
- http.cert = ssl[:client_cert] if ssl[:client_cert]
136
+ cert, *extra_chain_cert = ssl[:client_cert]
137
+ http.cert = cert if cert
138
+ http.extra_chain_cert = extra_chain_cert if extra_chain_cert.any?
139
+
142
140
  http.key = ssl[:client_key] if ssl[:client_key]
143
141
  http.ca_file = ssl[:ca_file] if ssl[:ca_file]
144
142
  http.ca_path = ssl[:ca_path] if ssl[:ca_path]
@@ -147,6 +145,7 @@ module Faraday
147
145
  http.min_version = ssl[:min_version] if ssl[:min_version]
148
146
  http.max_version = ssl[:max_version] if ssl[:max_version]
149
147
  http.verify_hostname = ssl[:verify_hostname] if verify_hostname_enabled?(http, ssl)
148
+ http.ciphers = ssl[:ciphers] if ssl[:ciphers]
150
149
  end
151
150
 
152
151
  def configure_request(http, req)
@@ -172,20 +171,18 @@ module Faraday
172
171
  def ssl_cert_store(ssl)
173
172
  return ssl[:cert_store] if ssl[:cert_store]
174
173
 
175
- @ssl_cert_store ||= begin
176
- # Use the default cert store by default, i.e. system ca certs
177
- OpenSSL::X509::Store.new.tap(&:set_default_paths)
178
- end
174
+ # Use the default cert store by default, i.e. system ca certs
175
+ @ssl_cert_store ||= OpenSSL::X509::Store.new.tap(&:set_default_paths)
179
176
  end
180
177
 
181
178
  def ssl_verify_mode(ssl)
182
179
  ssl[:verify_mode] || begin
183
- if ssl.fetch(:verify, true)
184
- OpenSSL::SSL::VERIFY_PEER
185
- else
186
- OpenSSL::SSL::VERIFY_NONE
187
- end
188
- end
180
+ if ssl.fetch(:verify, true)
181
+ OpenSSL::SSL::VERIFY_PEER
182
+ else
183
+ OpenSSL::SSL::VERIFY_NONE
184
+ end
185
+ end
189
186
  end
190
187
 
191
188
  def encoded_body(http_response)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Faraday
4
4
  module NetHttp
5
- VERSION = '3.0.2'
5
+ VERSION = '3.3.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faraday-net_http
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.2
4
+ version: 3.3.0
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: 2022-11-11 00:00:00.000000000 Z
11
+ date: 2024-08-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: faraday
14
+ name: net-http
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '2.5'
20
- type: :development
19
+ version: '0'
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: '2.5'
26
+ version: '0'
27
27
  description: Faraday adapter for Net::HTTP
28
28
  email:
29
29
  - janvanderpas@gmail.com
@@ -42,7 +42,8 @@ licenses:
42
42
  metadata:
43
43
  homepage_uri: https://github.com/lostisland/faraday-net_http
44
44
  source_code_uri: https://github.com/lostisland/faraday-net_http
45
- changelog_uri: https://github.com/lostisland/faraday-net_http/releases/tag/v3.0.2
45
+ changelog_uri: https://github.com/lostisland/faraday-net_http/releases/tag/v3.3.0
46
+ rubygems_mfa_required: 'true'
46
47
  post_install_message:
47
48
  rdoc_options: []
48
49
  require_paths:
@@ -51,14 +52,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
51
52
  requirements:
52
53
  - - ">="
53
54
  - !ruby/object:Gem::Version
54
- version: 2.6.0
55
+ version: 3.0.0
55
56
  required_rubygems_version: !ruby/object:Gem::Requirement
56
57
  requirements:
57
58
  - - ">="
58
59
  - !ruby/object:Gem::Version
59
60
  version: '0'
60
61
  requirements: []
61
- rubygems_version: 3.1.6
62
+ rubygems_version: 3.5.11
62
63
  signing_key:
63
64
  specification_version: 4
64
65
  summary: Faraday adapter for Net::HTTP