httpx 1.6.1 → 1.6.2

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: 947d1ad4fd269f30707292be54687f7be2054147fb3fa471c76395e92c55820e
4
- data.tar.gz: d6e321ace4211e8bf8215eff799b5c98aad627990db5b9b2cc091fe5b1b95df7
3
+ metadata.gz: 7c039169fa319d4e42cff7cb34d8a9cc7fc571e62565f673c32436645780222c
4
+ data.tar.gz: 6affb65b4fa71aa813cffc498034e0c6a6609bcdb0fca9d0ae9df738d4786d1d
5
5
  SHA512:
6
- metadata.gz: bd87db725b6da121b79f266a8a309816f5afea4ec1890a14720c16a667ea32632fdbdd9d74249b337672315fd2ac16c1488d8aa13f4e031b33751e1625f2c9a5
7
- data.tar.gz: 00027b822dff3985519aba56eb7b3bd28d0d81eacbdeb9d49f6e778023d60ae3eaf1a2469cf11287da12c0dde2a23b1557da33e77310ea6733e03e4f73b822e2
6
+ metadata.gz: 21be43709d51f7c50d1624923bc1657c9f096b84686612ff70f660af320d71d94d28a52ccef05f27558d74f22e1fd307944ca8ddf8b6c74c0b322e83eaad9b19
7
+ data.tar.gz: c551d2b32a71c5bbf099283b3577abe80d5005f702af5edefb79f445296c37c8fb9afb3d52b18db254a0c4ddd115d5f45953549f9b3c99c90ff8b86aedd6cb91
@@ -0,0 +1,11 @@
1
+ # 1.6.2
2
+
3
+ ## Bugfixes
4
+
5
+ * revert of behaviour introduced in 1.6.1 around handling of `:ip_families` for name resolution.
6
+ * when no option is passed, do not assume no IPv6 connectivity if no available non-local IP is found, as the local network may still be reachable under `[::]`.
7
+ * bail out connection if the tcp connection was established but the ssl session failed.
8
+ * when alpn negotiation succeeded, this could still initialize the HTTP/2 connection and put bytes in the buffer, which would cause a busy loop trying to write to a non-open socket.
9
+ * datadog: fix initialization of spans in non-connection related errors
10
+ * past code was relying on the error being around DNS, but other errors could pop; the fix was moving the init time setup early to the session, when a request is first passed ot the associated connection.
11
+ * it can also fail earlier, so provide a workaround for that as well.
@@ -180,7 +180,7 @@ module Datadog::Tracing
180
180
  end
181
181
 
182
182
  module RequestMethods
183
- attr_reader :init_time
183
+ attr_accessor :init_time
184
184
 
185
185
  # intercepts request initialization to inject the tracing logic.
186
186
  def initialize(*)
@@ -193,26 +193,30 @@ module Datadog::Tracing
193
193
  RequestTracer.call(self)
194
194
  end
195
195
 
196
- def response=(response)
197
- if response.is_a?(::HTTPX::ErrorResponse) && response.error.respond_to?(:connection)
198
- # handles the case when the +error+ happened during name resolution, which means
199
- # that the tracing start point hasn't been triggered yet; in such cases, the approximate
200
- # initial resolving time is collected from the connection, and used as span start time,
201
- # and the tracing object in inserted before the on response callback is called.
202
- @init_time = response.error.connection.init_time
203
- end
196
+ def response=(*)
197
+ # init_time should be set when it's send to a connection.
198
+ # However, there are situations where connection initialization fails.
199
+ # Example is the :ssrf_filter plugin, which raises an error on
200
+ # initialize if the host is an IP which matches against the known set.
201
+ # in such cases, we'll just set here right here.
202
+ @init_time ||= ::Datadog::Core::Utils::Time.now.utc
203
+
204
204
  super
205
205
  end
206
206
  end
207
207
 
208
208
  module ConnectionMethods
209
- attr_reader :init_time
210
-
211
209
  def initialize(*)
212
210
  super
213
211
 
214
212
  @init_time = ::Datadog::Core::Utils::Time.now.utc
215
213
  end
214
+
215
+ def send(request)
216
+ request.init_time ||= @init_time
217
+
218
+ super
219
+ end
216
220
  end
217
221
  end
218
222
 
@@ -243,6 +243,10 @@ module HTTPX
243
243
  case @state
244
244
  when :idle
245
245
  connect
246
+
247
+ # when opening the tcp or ssl socket fails
248
+ return if @state == :closed
249
+
246
250
  consume
247
251
  when :closed
248
252
  return
@@ -69,11 +69,11 @@ module HTTPX
69
69
  addresses = @resolver_options[:cache] && (connection.addresses || HTTPX::Resolver.nolookup_resolve(hostname))
70
70
  return false unless addresses
71
71
 
72
- ip_families = connection.options.ip_families || Resolver.supported_ip_families
72
+ ip_families = connection.options.ip_families
73
73
 
74
74
  resolved = false
75
75
  addresses.group_by(&:family).sort { |(f1, _), (f2, _)| f2 <=> f1 }.each do |family, addrs|
76
- next unless ip_families.include?(family)
76
+ next unless ip_families.nil? || ip_families.include?(family)
77
77
 
78
78
  # try to match the resolver by family. However, there are cases where that's not possible, as when
79
79
  # the system does not have IPv6 connectivity, but it does support IPv6 via loopback/link-local.
@@ -91,11 +91,7 @@ module HTTPX
91
91
  end
92
92
 
93
93
  def lazy_resolve(connection)
94
- ip_families = connection.options.ip_families || Resolver.supported_ip_families
95
-
96
94
  @resolvers.each do |resolver|
97
- next unless ip_families.include?(resolver.family)
98
-
99
95
  resolver << @current_session.try_clone_connection(connection, @current_selector, resolver.family)
100
96
  next if resolver.empty?
101
97
 
data/lib/httpx/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HTTPX
4
- VERSION = "1.6.1"
4
+ VERSION = "1.6.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: httpx
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.1
4
+ version: 1.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tiago Cardoso
@@ -157,6 +157,7 @@ extra_rdoc_files:
157
157
  - doc/release_notes/1_5_1.md
158
158
  - doc/release_notes/1_6_0.md
159
159
  - doc/release_notes/1_6_1.md
160
+ - doc/release_notes/1_6_2.md
160
161
  files:
161
162
  - LICENSE.txt
162
163
  - README.md
@@ -286,6 +287,7 @@ files:
286
287
  - doc/release_notes/1_5_1.md
287
288
  - doc/release_notes/1_6_0.md
288
289
  - doc/release_notes/1_6_1.md
290
+ - doc/release_notes/1_6_2.md
289
291
  - lib/httpx.rb
290
292
  - lib/httpx/adapters/datadog.rb
291
293
  - lib/httpx/adapters/faraday.rb