faraday-excon 2.3.0 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7bbcf7b4182d4b9c827a50b635494c89d977fed212f758c21c6b9c741bbea05a
4
- data.tar.gz: 1abd0666f0e76037e418fd24b8fb123fbe3f15e728c1b5214ddfa46355b3c74e
3
+ metadata.gz: 73929aac6bc0fcf47ec852b326cbd6b9069028fb5c20c8a3744e2a4023be0f6c
4
+ data.tar.gz: b2434d370c485a6d23690acf3140d1f9099d6c4abb41b4e33798923fff00d002
5
5
  SHA512:
6
- metadata.gz: 740ecb577e4c0034e522d103921975fc7de6fbeeb9091062478101b5b352356e082686bfa479f8fad82f9020f40c0346d180fae00b87eaa38cb0a7e13cebdc2d
7
- data.tar.gz: '0711564980593e61bf9309cffab664ceb7cbb77a0f32f3006acefc9cf950d3b7e2c4b7941781fa23968a846b459e1bd0c164b94e05469bd6187ed58b1541d439'
6
+ metadata.gz: 4ac1fc9d8592643820591f584cc10af0815b208928df7640b89716eb0044360b571f8da6cb9a3fb4c30009e82d877e42a947c381bbd4dd8c6da204175f171baa
7
+ data.tar.gz: 0ae26c632ed1c85145373faa55452cd895004ab495b3fa39367bdcc9b339f5b1e8a6d40e12edc3d01e02361fbb86b74aa5d89ee470e04f8428efd9d37a9a5e42
@@ -4,15 +4,25 @@ module Faraday
4
4
  class Adapter
5
5
  # Excon adapter.
6
6
  class Excon < Faraday::Adapter
7
+ OPTS_KEYS = [
8
+ %i[ciphers ciphers],
9
+ %i[client_cert client_cert],
10
+ %i[client_key client_key],
11
+ %i[certificate certificate],
12
+ %i[private_key private_key],
13
+ %i[ssl_ca_path ca_path],
14
+ %i[ssl_ca_file ca_file],
15
+ %i[ssl_version version],
16
+ %i[ssl_min_version min_version],
17
+ %i[ssl_max_version max_version]
18
+ ].freeze
19
+
7
20
  def build_connection(env)
8
- if @connection_options[:persistent] && defined?(@connection)
9
- return @connection
10
- end
21
+ return @connection if @connection_options[:persistent] && defined?(@connection)
11
22
 
12
23
  opts = opts_from_env(env)
13
24
 
14
- # remove path & query when creating connection
15
- # because if it is persistent, it can re-use the conn
25
+ # remove path & query, because persistent can re-use connection
16
26
  url = env[:url].dup
17
27
  url.path = ''
18
28
  url.query = nil
@@ -32,16 +42,21 @@ module Faraday
32
42
  }
33
43
 
34
44
  req = env[:request]
35
- if req&.stream_response?
45
+ yielded = false
46
+ if env.stream_response?
36
47
  total = 0
37
48
  req_opts[:response_block] = lambda do |chunk, _remain, _total|
38
- req.on_data.call(chunk, total += chunk.size)
49
+ yielded = true
50
+ req.on_data.call(chunk, total += chunk.bytesize, env)
39
51
  end
40
52
  end
41
53
 
42
54
  resp = connect_and_request(env, req_opts)
43
- save_response(env, resp.status.to_i, resp.body, resp.headers,
44
- resp.reason_phrase)
55
+
56
+ # duplicate env.stream_response helper behavior for empty streams
57
+ req.on_data.call(+'', 0, env) if req&.stream_response? && !yielded
58
+
59
+ save_response(env, resp.status.to_i, resp.body, resp.headers, resp.reason_phrase)
45
60
 
46
61
  @app.call(env)
47
62
  end
@@ -81,19 +96,6 @@ module Faraday
81
96
  env[:url].scheme == 'https' && env[:ssl]
82
97
  end
83
98
 
84
- OPTS_KEYS = [
85
- %i[ciphers ciphers],
86
- %i[client_cert client_cert],
87
- %i[client_key client_key],
88
- %i[certificate certificate],
89
- %i[private_key private_key],
90
- %i[ssl_ca_path ca_path],
91
- %i[ssl_ca_file ca_file],
92
- %i[ssl_version version],
93
- %i[ssl_min_version min_version],
94
- %i[ssl_max_version max_version]
95
- ].freeze
96
-
97
99
  def amend_opts_with_ssl!(opts, ssl)
98
100
  opts[:ssl_verify_peer] = !!ssl.fetch(:verify, true)
99
101
  # https://github.com/geemus/excon/issues/106
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Faraday
4
4
  module Excon
5
- VERSION = '2.3.0'
5
+ VERSION = '2.4.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faraday-excon
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - "@geemus"
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-10-24 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: excon
@@ -63,8 +62,8 @@ metadata:
63
62
  homepage_uri: https://github.com/excon/faraday-excon
64
63
  rubygems_mfa_required: 'true'
65
64
  source_code_uri: https://github.com/excon/faraday-excon
66
- changelog_uri: https://github.com/excon/faraday-excon/releases/tag/v2.3.0
67
- post_install_message:
65
+ changelog_uri: https://github.com/excon/faraday-excon/releases/tag/v2.4.0
66
+ funding_uri: https://github.com/sponsors/geemus
68
67
  rdoc_options: []
69
68
  require_paths:
70
69
  - lib
@@ -79,8 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
79
78
  - !ruby/object:Gem::Version
80
79
  version: '0'
81
80
  requirements: []
82
- rubygems_version: 3.5.18
83
- signing_key:
81
+ rubygems_version: 3.6.9
84
82
  specification_version: 4
85
83
  summary: Faraday adapter for Excon
86
84
  test_files: []