httpx 0.22.4 → 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: 4d5e3e33caae5726e0c7630721296abac27073ed1fc071a7bb8c9467a2b1b2e0
4
- data.tar.gz: f4344aee8002ecbe64d6e3321e1ca9f18507e2fd70223890211e05ab15967479
3
+ metadata.gz: 1346874cf311c485468e6c99054806adfde48a145d9b012a9a2a2e56a9ae3a8b
4
+ data.tar.gz: 4b345ffef12d65d66787e59bc3ed8c01619a343246ddd433a1a0e807029f14de
5
5
  SHA512:
6
- metadata.gz: 9c42940a7467f91f66779bdf26b83043fb99b17033d69cee7d7656946abc03a064f1b9952889b3c783b757429d5cc6d476575ff9ab347524738152f846c3ea91
7
- data.tar.gz: 6199caed20de123a10af893a85c2657cc4b4bfb6645592a5155743e74a37ff754d3fcf404c8bb28582bead974b35c6f872d40d8b5ac77806bdc4b34992847e7a
6
+ metadata.gz: 6dfa20f805f0421917c6aee58ff2bedb31173d4b227fa76c6b23d1af9ee903242f26ab12474907400d5e6dae7b0fe4084c771689e4e6391ff6227277a7beef9b
7
+ data.tar.gz: 7d8a89d569f0b8abc775eae0563450e1e9470c7a74cd7aa249abc49570901f6ceb0548ba5236b1575ba17e9f8a17c433cea12a1708a9df3b520c599304bcd458
@@ -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
@@ -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,8 +141,9 @@ 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
 
@@ -156,8 +157,9 @@ module HTTPX
156
157
  if connection.connecting?
157
158
  # main connection has the requests
158
159
  connection.merge(new_connection)
160
+ new_connection.force_reset
159
161
  else
160
- new_connection.handle_error(err)
162
+ new_connection.__send__(:handle_error, err)
161
163
  end
162
164
  end
163
165
 
@@ -183,6 +185,8 @@ module HTTPX
183
185
  end
184
186
 
185
187
  def on_resolver_error(connection, error)
188
+ return connection.emit(:connect_error, error) if connection.connecting? && connection.callbacks_for?(:connect_error)
189
+
186
190
  connection.emit(:error, error)
187
191
  end
188
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)
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.4"
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.4
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-02-08 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
@@ -93,6 +93,7 @@ extra_rdoc_files:
93
93
  - doc/release_notes/0_22_2.md
94
94
  - doc/release_notes/0_22_3.md
95
95
  - doc/release_notes/0_22_4.md
96
+ - doc/release_notes/0_22_5.md
96
97
  - doc/release_notes/0_2_0.md
97
98
  - doc/release_notes/0_2_1.md
98
99
  - doc/release_notes/0_3_0.md
@@ -178,6 +179,7 @@ files:
178
179
  - doc/release_notes/0_22_2.md
179
180
  - doc/release_notes/0_22_3.md
180
181
  - doc/release_notes/0_22_4.md
182
+ - doc/release_notes/0_22_5.md
181
183
  - doc/release_notes/0_2_0.md
182
184
  - doc/release_notes/0_2_1.md
183
185
  - doc/release_notes/0_3_0.md
@@ -390,7 +392,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
390
392
  - !ruby/object:Gem::Version
391
393
  version: '0'
392
394
  requirements: []
393
- rubygems_version: 3.4.1
395
+ rubygems_version: 3.3.7
394
396
  signing_key:
395
397
  specification_version: 4
396
398
  summary: HTTPX, to the future, and beyond