httpx 0.22.3 → 0.22.5

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: 39a428f7a8a6747513b56a5e2b4216569363b71baa273d1904b3805f6385e1aa
4
- data.tar.gz: 900178247910015b23dcc199df570dadde117d3837efecc5b7100e6478054a77
3
+ metadata.gz: 1346874cf311c485468e6c99054806adfde48a145d9b012a9a2a2e56a9ae3a8b
4
+ data.tar.gz: 4b345ffef12d65d66787e59bc3ed8c01619a343246ddd433a1a0e807029f14de
5
5
  SHA512:
6
- metadata.gz: 77d450b37b3dacbc998b4a659d2ddfe80ae0fcf38cbbad79a2ab8df10522f0cc69e57979960559503bd9a00eb775b1e664f3ada81d8aaad0a1ae29765ff4868c
7
- data.tar.gz: 40d9e2b9cb187f0610d5985128227aedc6ed2c3cde55adcb69e6abd20fd9048d96fb05357e320bdb90442bb3553cacca5aa0368e5455344034d654c902412318
6
+ metadata.gz: 6dfa20f805f0421917c6aee58ff2bedb31173d4b227fa76c6b23d1af9ee903242f26ab12474907400d5e6dae7b0fe4084c771689e4e6391ff6227277a7beef9b
7
+ data.tar.gz: 7d8a89d569f0b8abc775eae0563450e1e9470c7a74cd7aa249abc49570901f6ceb0548ba5236b1575ba17e9f8a17c433cea12a1708a9df3b520c599304bcd458
@@ -0,0 +1,6 @@
1
+ # 0.22.4
2
+
3
+ ## Bugfixes
4
+
5
+ * fix happy eyeballs v2 bug where, once the first connection would be established, the remaining one would still end up in the coalescing loop, thereby closing itself via the `:tcp_open` callback.
6
+ * fix for faraday plugin parallel mode, where it'd hang if no requests would be made in the parallel block (@catlee)
@@ -0,0 +1,6 @@
1
+ # 0.22.5
2
+
3
+ ## Bugfixes
4
+
5
+ * `datadog` and `sentry` integrations did not account for `Connection#send` being possibly called multiple times (something possible for connection coalescing, max requests exhaustion, or Happy Eyeballs 2), and were registering multiple `on(:response)` callbacks. Requests are now marked when decorated the first time.
6
+ * Happy Eyeballs handshake "connect errors" routine is now taking both name resolution errors, as well as TLS handshake errors, into account, when the handshake fails.
@@ -158,9 +158,19 @@ module TRACING_MODULE # rubocop:disable Naming/ClassAndModuleCamelCase
158
158
  end
159
159
  end
160
160
 
161
+ module RequestMethods
162
+ def __datadog_enable_trace!
163
+ return super if @__datadog_enable_trace
164
+
165
+ RequestTracer.new(self).call
166
+ @__datadog_enable_trace = true
167
+ end
168
+ end
169
+
161
170
  module ConnectionMethods
162
171
  def send(request)
163
- RequestTracer.new(request).call
172
+ request.__datadog_enable_trace!
173
+
164
174
  super
165
175
  end
166
176
  end
@@ -169,6 +169,8 @@ module Faraday
169
169
  end
170
170
 
171
171
  def run
172
+ return unless @handlers.last
173
+
172
174
  env = @handlers.last.env
173
175
 
174
176
  session = HTTPX.session.with(options_from_env(env))
@@ -89,9 +89,19 @@ module HTTPX::Plugins
89
89
  end
90
90
  end
91
91
 
92
+ module RequestMethods
93
+ def __sentry_enable_trace!
94
+ return super if @__sentry_enable_trace
95
+
96
+ Tracer.call(self)
97
+ @__sentry_enable_trace = true
98
+ end
99
+ end
100
+
92
101
  module ConnectionMethods
93
102
  def send(request)
94
- Tracer.call(request)
103
+ request.__sentry_enable_trace!
104
+
95
105
  super
96
106
  end
97
107
  end
@@ -22,12 +22,12 @@ module HTTPX
22
22
  callbacks(type).delete_if { |pr| :delete == pr.call(*args) } # rubocop:disable Style/YodaCondition
23
23
  end
24
24
 
25
- protected
26
-
27
25
  def callbacks_for?(type)
28
- @callbacks.key?(type) && !@callbacks[type].empty?
26
+ @callbacks.key?(type) && @callbacks[type].any?
29
27
  end
30
28
 
29
+ protected
30
+
31
31
  def callbacks(type = nil)
32
32
  return @callbacks unless type
33
33
 
@@ -538,12 +538,13 @@ module HTTPX
538
538
  # connect errors, exit gracefully
539
539
  error = ConnectionError.new(e.message)
540
540
  error.set_backtrace(e.backtrace)
541
- connecting? && callbacks(:connect_error).any? ? emit(:connect_error, error) : handle_error(error)
541
+ connecting? && callbacks_for?(:connect_error) ? emit(:connect_error, error) : handle_error(error)
542
542
  @state = :closed
543
543
  emit(:close)
544
544
  rescue TLSError => e
545
545
  # connect errors, exit gracefully
546
546
  handle_error(e)
547
+ connecting? && callbacks_for?(:connect_error) ? emit(:connect_error, e) : handle_error(e)
547
548
  @state = :closed
548
549
  emit(:close)
549
550
  end
data/lib/httpx/pool.rb CHANGED
@@ -141,21 +141,25 @@ module HTTPX
141
141
  connection.once(:connect_error) do |err|
142
142
  if new_connection.connecting?
143
143
  new_connection.merge(connection)
144
+ connection.force_reset
144
145
  else
145
- connection.handle_error(err)
146
+ connection.__send__(:handle_error, err)
146
147
  end
147
148
  end
148
149
 
149
150
  new_connection.once(:tcp_open) do |new_conn|
150
- new_conn.merge(connection)
151
- connection.force_reset
151
+ if new_conn != connection
152
+ new_conn.merge(connection)
153
+ connection.force_reset
154
+ end
152
155
  end
153
156
  new_connection.once(:connect_error) do |err|
154
157
  if connection.connecting?
155
158
  # main connection has the requests
156
159
  connection.merge(new_connection)
160
+ new_connection.force_reset
157
161
  else
158
- new_connection.handle_error(err)
162
+ new_connection.__send__(:handle_error, err)
159
163
  end
160
164
  end
161
165
 
@@ -181,6 +185,8 @@ module HTTPX
181
185
  end
182
186
 
183
187
  def on_resolver_error(connection, error)
188
+ return connection.emit(:connect_error, error) if connection.connecting? && connection.callbacks_for?(:connect_error)
189
+
184
190
  connection.emit(:error, error)
185
191
  end
186
192
 
@@ -64,12 +64,7 @@ module HTTPX
64
64
  end
65
65
 
66
66
  def on_resolver_error(connection, error)
67
- @errors[connection] << error
68
-
69
- return unless @errors[connection].size >= @resolvers.size
70
-
71
- errors = @errors.delete(connection)
72
- emit(:error, connection, errors.first)
67
+ emit(:error, connection, error)
73
68
  end
74
69
 
75
70
  def on_resolver_close(resolver)
@@ -73,7 +73,7 @@ module HTTPX
73
73
  end
74
74
 
75
75
  def params_hash_has_key?(hash, key)
76
- return false if /\[\]/.match?(key)
76
+ return false if key.include?("[]")
77
77
 
78
78
  key.split(/[\[\]]+/).inject(hash) do |h, part|
79
79
  next h if part == ""
data/lib/httpx/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HTTPX
4
- VERSION = "0.22.3"
4
+ VERSION = "0.22.5"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: httpx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.22.3
4
+ version: 0.22.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tiago Cardoso
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-25 00:00:00.000000000 Z
11
+ date: 2023-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http-2-next
@@ -92,6 +92,8 @@ extra_rdoc_files:
92
92
  - doc/release_notes/0_22_1.md
93
93
  - doc/release_notes/0_22_2.md
94
94
  - doc/release_notes/0_22_3.md
95
+ - doc/release_notes/0_22_4.md
96
+ - doc/release_notes/0_22_5.md
95
97
  - doc/release_notes/0_2_0.md
96
98
  - doc/release_notes/0_2_1.md
97
99
  - doc/release_notes/0_3_0.md
@@ -176,6 +178,8 @@ files:
176
178
  - doc/release_notes/0_22_1.md
177
179
  - doc/release_notes/0_22_2.md
178
180
  - doc/release_notes/0_22_3.md
181
+ - doc/release_notes/0_22_4.md
182
+ - doc/release_notes/0_22_5.md
179
183
  - doc/release_notes/0_2_0.md
180
184
  - doc/release_notes/0_2_1.md
181
185
  - doc/release_notes/0_3_0.md