httpx 1.7.4 → 1.7.5
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 +4 -4
- data/doc/release_notes/1_7_5.md +10 -0
- data/lib/httpx/adapters/datadog.rb +1 -5
- data/lib/httpx/plugins/expect.rb +3 -0
- data/lib/httpx/plugins/tracing.rb +4 -4
- data/lib/httpx/selector.rb +3 -3
- data/lib/httpx/session.rb +19 -38
- data/lib/httpx/timers.rb +4 -0
- data/lib/httpx/version.rb +1 -1
- data/sig/plugins/expect.rbs +4 -0
- data/sig/plugins/fiber_concurrency.rbs +2 -2
- data/sig/selector.rbs +3 -2
- data/sig/timers.rbs +2 -0
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7e9530bb05303e7e15a05a84a26650fc2dd0ec0c35c11c909b07d8deb499f00f
|
|
4
|
+
data.tar.gz: 29043b781e3f12cf18ca80eeb6979833536b659dd13ce76d5312fe20f3b61342
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dea67bc736ed82b32c6c81257d66ca2dac2fae2cf41cb923fdca28c4c9741e5f57b0b56b3bfa23f6b0990f6faf26d14258b296ef771681d405564e02fafaceb5
|
|
7
|
+
data.tar.gz: 13dda593ac028e1d34b6ca0e22dd6a024705bf542da756a013f5da7f0abcccaab76860e80e5d8586ff95d4fe258542a295c004d33866a7986407c6cd4950f9e9
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# 1.7.5
|
|
2
|
+
|
|
3
|
+
## Improvements
|
|
4
|
+
|
|
5
|
+
* `:tracing` plugin: make `Request#init_time` a UTC timestamp.
|
|
6
|
+
|
|
7
|
+
## Bugfixes
|
|
8
|
+
|
|
9
|
+
* fixed handling of conditional responses which was making a batch of concurrent requests being handled serially after they failed.
|
|
10
|
+
* `datadog` adapter: use `Request#init_time` as the span start time, which will fix the bug where the span wasn't including the time it takes to open the connection (TCP/TLS handhshakes).
|
|
@@ -51,7 +51,7 @@ module Datadog::Tracing
|
|
|
51
51
|
end
|
|
52
52
|
|
|
53
53
|
def start(request)
|
|
54
|
-
request.datadog_span = initialize_span(request,
|
|
54
|
+
request.datadog_span = initialize_span(request, request.init_time)
|
|
55
55
|
end
|
|
56
56
|
|
|
57
57
|
def reset(request)
|
|
@@ -132,10 +132,6 @@ module Datadog::Tracing
|
|
|
132
132
|
Datadog.logger.error(e.backtrace)
|
|
133
133
|
end
|
|
134
134
|
|
|
135
|
-
def now
|
|
136
|
-
::Datadog::Core::Utils::Time.now.utc
|
|
137
|
-
end
|
|
138
|
-
|
|
139
135
|
def configuration(request)
|
|
140
136
|
Datadog.configuration.tracing[:httpx, request.uri.host]
|
|
141
137
|
end
|
data/lib/httpx/plugins/expect.rb
CHANGED
|
@@ -89,7 +89,7 @@ module HTTPX::Plugins
|
|
|
89
89
|
on(:headers) do
|
|
90
90
|
# the usual request init time (when not including the connection handshake)
|
|
91
91
|
# should be the time the request is buffered the first time.
|
|
92
|
-
@init_time ||= ::Time.now
|
|
92
|
+
@init_time ||= ::Time.now.utc
|
|
93
93
|
|
|
94
94
|
tracer.start(self)
|
|
95
95
|
end
|
|
@@ -102,7 +102,7 @@ module HTTPX::Plugins
|
|
|
102
102
|
# Example is the :ssrf_filter plugin, which raises an error on
|
|
103
103
|
# initialize if the host is an IP which matches against the known set.
|
|
104
104
|
# in such cases, we'll just set here right here.
|
|
105
|
-
@init_time ||= ::Time.now
|
|
105
|
+
@init_time ||= ::Time.now.utc
|
|
106
106
|
|
|
107
107
|
super
|
|
108
108
|
end
|
|
@@ -113,7 +113,7 @@ module HTTPX::Plugins
|
|
|
113
113
|
def initialize(*)
|
|
114
114
|
super
|
|
115
115
|
|
|
116
|
-
@init_time = ::Time.now
|
|
116
|
+
@init_time = ::Time.now.utc
|
|
117
117
|
end
|
|
118
118
|
|
|
119
119
|
def send(request)
|
|
@@ -129,7 +129,7 @@ module HTTPX::Plugins
|
|
|
129
129
|
|
|
130
130
|
# time of initial request(s) is accounted from the moment
|
|
131
131
|
# the connection is back to :idle, and ready to connect again.
|
|
132
|
-
@init_time = ::Time.now
|
|
132
|
+
@init_time = ::Time.now.utc
|
|
133
133
|
end
|
|
134
134
|
end
|
|
135
135
|
end
|
data/lib/httpx/selector.rb
CHANGED
|
@@ -29,7 +29,7 @@ module HTTPX
|
|
|
29
29
|
|
|
30
30
|
def_delegator :@timers, :after
|
|
31
31
|
|
|
32
|
-
def_delegator :@selectables, :
|
|
32
|
+
def_delegator :@selectables, :each
|
|
33
33
|
|
|
34
34
|
def initialize
|
|
35
35
|
@timers = Timers.new
|
|
@@ -37,8 +37,8 @@ module HTTPX
|
|
|
37
37
|
@is_timer_interval = false
|
|
38
38
|
end
|
|
39
39
|
|
|
40
|
-
def
|
|
41
|
-
@selectables.
|
|
40
|
+
def empty?
|
|
41
|
+
@selectables.empty? && @timers.empty?
|
|
42
42
|
end
|
|
43
43
|
|
|
44
44
|
def next_tick
|
data/lib/httpx/session.rb
CHANGED
|
@@ -325,53 +325,34 @@ module HTTPX
|
|
|
325
325
|
|
|
326
326
|
# returns the array of HTTPX::Response objects corresponding to the array of HTTPX::Request +requests+.
|
|
327
327
|
def receive_requests(requests, selector)
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
return responses unless request
|
|
335
|
-
|
|
336
|
-
catch(:coalesced) { selector.next_tick } until (response = fetch_response(request, selector, request.options))
|
|
337
|
-
request.complete!(response)
|
|
338
|
-
|
|
339
|
-
responses << response
|
|
340
|
-
requests.shift
|
|
341
|
-
|
|
342
|
-
break if requests.empty?
|
|
328
|
+
waiting = 0
|
|
329
|
+
responses = requests.map do |request|
|
|
330
|
+
fetch_response(request, selector, request.options).tap do |response|
|
|
331
|
+
waiting += 1 if response.nil?
|
|
332
|
+
end
|
|
333
|
+
end
|
|
343
334
|
|
|
344
|
-
|
|
335
|
+
until waiting.zero? || selector.empty?
|
|
336
|
+
# loop on selector until at least one response has been received.
|
|
337
|
+
catch(:coalesced) { selector.next_tick }
|
|
345
338
|
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
# opportunity to traverse the requests, hence we're returning only a fraction of the errors
|
|
349
|
-
# we were supposed to. This effectively fetches the existing responses and return them.
|
|
350
|
-
exit_from_loop = true
|
|
339
|
+
responses.each_with_index do |response, idx|
|
|
340
|
+
next unless response.nil?
|
|
351
341
|
|
|
352
|
-
|
|
342
|
+
request = requests[idx]
|
|
353
343
|
|
|
354
|
-
|
|
355
|
-
response = fetch_response(req, selector, request.options)
|
|
344
|
+
response = fetch_response(request, selector, request.options)
|
|
356
345
|
|
|
357
|
-
|
|
358
|
-
req.complete!(response)
|
|
359
|
-
responses << response
|
|
360
|
-
requests_to_remove << req
|
|
361
|
-
else
|
|
362
|
-
# fetch_response may resend requests. when that happens, we need to go back to the initial
|
|
363
|
-
# loop and process the selector. we still do a pass-through on the remainder of requests, so
|
|
364
|
-
# that every request that need to be resent, is resent.
|
|
365
|
-
exit_from_loop = false
|
|
346
|
+
next unless response
|
|
366
347
|
|
|
367
|
-
|
|
368
|
-
|
|
348
|
+
request.complete!(response)
|
|
349
|
+
responses[idx] = response
|
|
350
|
+
waiting -= 1
|
|
369
351
|
end
|
|
352
|
+
end
|
|
370
353
|
|
|
371
|
-
|
|
354
|
+
raise Error, "something went wrong, responses not found and requests not resent" unless waiting.zero?
|
|
372
355
|
|
|
373
|
-
requests -= requests_to_remove
|
|
374
|
-
end
|
|
375
356
|
responses
|
|
376
357
|
end
|
|
377
358
|
|
data/lib/httpx/timers.rb
CHANGED
data/lib/httpx/version.rb
CHANGED
data/sig/plugins/expect.rbs
CHANGED
|
@@ -9,12 +9,12 @@ module HTTPX
|
|
|
9
9
|
|
|
10
10
|
def set_context!: () -> void
|
|
11
11
|
|
|
12
|
-
def current_context?: () ->
|
|
12
|
+
def current_context?: () -> boolish
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
module ConnectionMethods
|
|
16
16
|
|
|
17
|
-
def current_context?: () ->
|
|
17
|
+
def current_context?: () -> boolish
|
|
18
18
|
|
|
19
19
|
def send: (request request) -> void
|
|
20
20
|
end
|
data/sig/selector.rbs
CHANGED
|
@@ -24,8 +24,6 @@ module HTTPX
|
|
|
24
24
|
|
|
25
25
|
type io_select_selectable = (selectable | Array[selectable])?
|
|
26
26
|
|
|
27
|
-
include _Each[selectable]
|
|
28
|
-
|
|
29
27
|
extend Forwardable
|
|
30
28
|
|
|
31
29
|
READABLE: Array[io_interests]
|
|
@@ -36,6 +34,9 @@ module HTTPX
|
|
|
36
34
|
@selectables: Array[selectable]
|
|
37
35
|
@is_timer_interval: bool
|
|
38
36
|
|
|
37
|
+
def each: () -> ::Enumerator[selectable, self]
|
|
38
|
+
| () { (selectable) -> void } -> self
|
|
39
|
+
|
|
39
40
|
def next_tick: () -> void
|
|
40
41
|
|
|
41
42
|
def terminate: () -> void
|
data/sig/timers.rbs
CHANGED
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.7.
|
|
4
|
+
version: 1.7.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tiago Cardoso
|
|
@@ -164,6 +164,7 @@ extra_rdoc_files:
|
|
|
164
164
|
- doc/release_notes/1_7_2.md
|
|
165
165
|
- doc/release_notes/1_7_3.md
|
|
166
166
|
- doc/release_notes/1_7_4.md
|
|
167
|
+
- doc/release_notes/1_7_5.md
|
|
167
168
|
files:
|
|
168
169
|
- LICENSE.txt
|
|
169
170
|
- README.md
|
|
@@ -300,6 +301,7 @@ files:
|
|
|
300
301
|
- doc/release_notes/1_7_2.md
|
|
301
302
|
- doc/release_notes/1_7_3.md
|
|
302
303
|
- doc/release_notes/1_7_4.md
|
|
304
|
+
- doc/release_notes/1_7_5.md
|
|
303
305
|
- lib/httpx.rb
|
|
304
306
|
- lib/httpx/adapters/datadog.rb
|
|
305
307
|
- lib/httpx/adapters/faraday.rb
|