faraday-net_http 3.0.1 → 3.1.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: 6dceca36c2e49d9e2642dd7d6177df8ee20d799efb59a2ae661a2790f05244a9
4
- data.tar.gz: c064e33f9fa0666b1b7402f5bb948401fd76c78205d627942b5e693b271fbaed
3
+ metadata.gz: 2d9a033eff57867fb6f0d7ef439a1a218ce10dcfad224979f1af82f96e8fa201
4
+ data.tar.gz: bce85e35b8871f4ec9ba42410043bd74608ce577ea5221f4397ee0929b2be03b
5
5
  SHA512:
6
- metadata.gz: 4b49ece078d46b76578f63b8efefeff9b10cade3eb71850583b5f1902f60aab105cbc4a81581718e33f0cb7a12357a07bf8f0440832aa85044adfbcd7a5cea2a
7
- data.tar.gz: 365a1b68e1f2bde815155b9836a281705ba6806155363245cc3ca837d6a3bfb014c4b8f0bd46984c52783f73a1f7957c2dd8ab6f39b84c639e15b4beae7b9a56
6
+ metadata.gz: 733173b97da6b8f8043dec130ddabb32f7f5e94673a095029d5d52b9b74326f34dee5fd2a6fcbcb91908d6168bce08ae22b2997d1c8e2124de3680f5c9e60bc4
7
+ data.tar.gz: e845d5bd38188d95f680a42b3ab78c06e8c485dcb27a6768ad4f4366208ca176b24db1ef657bfd3cb5c72c9b32440b4d536910bba36a454bfea52214a68f08a1
@@ -106,18 +106,14 @@ module Faraday
106
106
  http_response
107
107
  end
108
108
 
109
- def request_with_wrapped_block(http, env)
109
+ def request_with_wrapped_block(http, env, &block)
110
110
  # Must use Net::HTTP#start and pass it a block otherwise the server's
111
111
  # TCP socket does not close correctly.
112
112
  http.start do |opened_http|
113
113
  opened_http.request create_request(env) do |response|
114
114
  save_http_response(env, response)
115
115
 
116
- if block_given?
117
- response.read_body do |chunk|
118
- yield(chunk)
119
- end
120
- end
116
+ response.read_body(&block) if block_given?
121
117
  end
122
118
  end
123
119
  end
@@ -172,26 +168,24 @@ module Faraday
172
168
  def ssl_cert_store(ssl)
173
169
  return ssl[:cert_store] if ssl[:cert_store]
174
170
 
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
171
+ # Use the default cert store by default, i.e. system ca certs
172
+ @ssl_cert_store ||= OpenSSL::X509::Store.new.tap(&:set_default_paths)
179
173
  end
180
174
 
181
175
  def ssl_verify_mode(ssl)
182
176
  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
177
+ if ssl.fetch(:verify, true)
178
+ OpenSSL::SSL::VERIFY_PEER
179
+ else
180
+ OpenSSL::SSL::VERIFY_NONE
181
+ end
182
+ end
189
183
  end
190
184
 
191
185
  def encoded_body(http_response)
192
186
  body = http_response.body || +''
193
- /\bcharset=(.+)/.match(http_response['Content-Type']) do |match|
194
- content_charset = ::Encoding.find(match.captures.first.split(';').first.strip)
187
+ /\bcharset=([^;]+)/.match(http_response['Content-Type']) do |match|
188
+ content_charset = ::Encoding.find(match[1].strip)
195
189
  body = body.dup if body.frozen?
196
190
  body.force_encoding(content_charset)
197
191
  rescue ArgumentError
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Faraday
4
4
  module NetHttp
5
- VERSION = '3.0.1'
5
+ VERSION = '3.1.0'
6
6
  end
7
7
  end
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: 3.0.1
4
+ version: 3.1.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-10-08 00:00:00.000000000 Z
11
+ date: 2024-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '2.5'
27
+ - !ruby/object:Gem::Dependency
28
+ name: net-http
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  description: Faraday adapter for Net::HTTP
28
42
  email:
29
43
  - janvanderpas@gmail.com
@@ -42,7 +56,7 @@ licenses:
42
56
  metadata:
43
57
  homepage_uri: https://github.com/lostisland/faraday-net_http
44
58
  source_code_uri: https://github.com/lostisland/faraday-net_http
45
- changelog_uri: https://github.com/lostisland/faraday-net_http/releases/tag/v3.0.1
59
+ changelog_uri: https://github.com/lostisland/faraday-net_http/releases/tag/v3.1.0
46
60
  post_install_message:
47
61
  rdoc_options: []
48
62
  require_paths:
@@ -51,14 +65,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
51
65
  requirements:
52
66
  - - ">="
53
67
  - !ruby/object:Gem::Version
54
- version: 2.6.0
68
+ version: 3.0.0
55
69
  required_rubygems_version: !ruby/object:Gem::Requirement
56
70
  requirements:
57
71
  - - ">="
58
72
  - !ruby/object:Gem::Version
59
73
  version: '0'
60
74
  requirements: []
61
- rubygems_version: 3.1.6
75
+ rubygems_version: 3.5.3
62
76
  signing_key:
63
77
  specification_version: 4
64
78
  summary: Faraday adapter for Net::HTTP