httpx 1.0.1 → 1.0.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 +4 -4
- data/doc/release_notes/0_24_7.md +10 -0
- data/doc/release_notes/1_0_2.md +7 -0
- data/lib/httpx/adapters/datadog.rb +44 -12
- data/lib/httpx/connection/http1.rb +1 -1
- data/lib/httpx/connection/http2.rb +5 -20
- data/lib/httpx/plugins/grpc.rb +16 -4
- data/lib/httpx/version.rb +1 -1
- metadata +8 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a0f330c17658b6d488b83008df23e73eb276c04fb93f6e72093224a1a6e1d839
|
4
|
+
data.tar.gz: 75fea2fe69162c00d371ca83f121883d435be3d7d0749f1f2dce71332c6f18d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c3bf06316177777f8802fc7662021e565ddc19590a2cad092ab3e05759fa778e7edd4f9b6ee9359b582d8828f669236be517129af57a12d17cfe71cde7adf06
|
7
|
+
data.tar.gz: 66ef58dbd0c3f4681bbde3e211afaaa7272d88aa4aa70e5791636147439a5bacb2bf85f89d0b33a792ddcf6444ae14e3c64685436b9cb849cb7fad30f3db1ef1
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# 0.24.6
|
2
|
+
|
3
|
+
## dependencies
|
4
|
+
|
5
|
+
`http-2-next` last supported version for the 0.x series is the last version before v1. This shoul ensure that older versions of `httpx` won't be affected by any of the recent breaking changes.
|
6
|
+
|
7
|
+
## Bugfixes
|
8
|
+
|
9
|
+
* `grpc`: setup of rpc calls from camel-cased symbols has been fixed. As an improvement, the GRPC-enabled session will now support both snake-cased, as well as camel-cased calls.
|
10
|
+
* `datadog` adapter has now been patched to support the most recent breaking changes of `ddtrace` configuration DSL (`env_to_bool` is no longer supported).
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# 1.0.2
|
2
|
+
|
3
|
+
## bugfixes
|
4
|
+
|
5
|
+
* bump `http-2-next` to 1.0.1, which fixes a bug where http/2 connection interprets MAX_CONCURRENT_STREAMS as request cap.
|
6
|
+
* `grpc`: setup of rpc calls from camel-cased symbols has been fixed. As an improvement, the GRPC-enabled session will now support both snake-cased, as well as camel-cased calls.
|
7
|
+
* `datadog` adapter has now been patched to support the most recent breaking changes of `ddtrace` configuration DSL (`env_to_bool` is no longer supported).
|
@@ -126,19 +126,39 @@ module Datadog::Tracing
|
|
126
126
|
option :distributed_tracing, default: true
|
127
127
|
option :split_by_domain, default: false
|
128
128
|
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
129
|
+
if DDTrace::VERSION::STRING >= "1.13.0"
|
130
|
+
option :enabled do |o|
|
131
|
+
o.type :bool
|
132
|
+
o.env "DD_TRACE_HTTPX_ENABLED"
|
133
|
+
o.default true
|
134
|
+
end
|
133
135
|
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
136
|
+
option :analytics_enabled do |o|
|
137
|
+
o.type :bool
|
138
|
+
o.env "DD_TRACE_HTTPX_ANALYTICS_ENABLED"
|
139
|
+
o.default false
|
140
|
+
end
|
141
|
+
|
142
|
+
option :analytics_sample_rate do |o|
|
143
|
+
o.type :float
|
144
|
+
o.env "DD_TRACE_HTTPX_ANALYTICS_SAMPLE_RATE"
|
145
|
+
o.default 1.0
|
146
|
+
end
|
147
|
+
else
|
148
|
+
option :enabled do |o|
|
149
|
+
o.default { env_to_bool("DD_TRACE_HTTPX_ENABLED", true) }
|
150
|
+
o.lazy
|
151
|
+
end
|
138
152
|
|
139
|
-
|
140
|
-
|
141
|
-
|
153
|
+
option :analytics_enabled do |o|
|
154
|
+
o.default { env_to_bool(%w[DD_TRACE_HTTPX_ANALYTICS_ENABLED DD_HTTPX_ANALYTICS_ENABLED], false) }
|
155
|
+
o.lazy
|
156
|
+
end
|
157
|
+
|
158
|
+
option :analytics_sample_rate do |o|
|
159
|
+
o.default { env_to_float(%w[DD_TRACE_HTTPX_ANALYTICS_SAMPLE_RATE DD_HTTPX_ANALYTICS_SAMPLE_RATE], 1.0) }
|
160
|
+
o.lazy
|
161
|
+
end
|
142
162
|
end
|
143
163
|
|
144
164
|
if defined?(Datadog::Tracing::Contrib::SpanAttributeSchema)
|
@@ -162,7 +182,19 @@ module Datadog::Tracing
|
|
162
182
|
|
163
183
|
option :distributed_tracing, default: true
|
164
184
|
|
165
|
-
|
185
|
+
if DDTrace::VERSION::STRING >= "1.15.0"
|
186
|
+
option :error_handler do |o|
|
187
|
+
o.type :proc
|
188
|
+
o.default_proc(&DEFAULT_ERROR_HANDLER)
|
189
|
+
end
|
190
|
+
elsif DDTrace::VERSION::STRING >= "1.13.0"
|
191
|
+
option :error_handler do |o|
|
192
|
+
o.type :proc
|
193
|
+
o.experimental_default_proc(&DEFAULT_ERROR_HANDLER)
|
194
|
+
end
|
195
|
+
else
|
196
|
+
option :error_handler, default: DEFAULT_ERROR_HANDLER
|
197
|
+
end
|
166
198
|
end
|
167
199
|
end
|
168
200
|
|
@@ -35,7 +35,7 @@ module HTTPX
|
|
35
35
|
@handshake_completed = false
|
36
36
|
@wait_for_handshake = @settings.key?(:wait_for_handshake) ? @settings.delete(:wait_for_handshake) : true
|
37
37
|
@max_concurrent_requests = @options.max_concurrent_requests || MAX_CONCURRENT_REQUESTS
|
38
|
-
@max_requests = @options.max_requests ||
|
38
|
+
@max_requests = @options.max_requests || Float::INFINITY
|
39
39
|
init_connection
|
40
40
|
end
|
41
41
|
|
@@ -82,9 +82,7 @@ module HTTPX
|
|
82
82
|
end
|
83
83
|
|
84
84
|
def exhausted?
|
85
|
-
|
86
|
-
|
87
|
-
@connection.active_stream_count >= @max_requests
|
85
|
+
!@max_requests.positive?
|
88
86
|
end
|
89
87
|
|
90
88
|
def <<(data)
|
@@ -92,13 +90,9 @@ module HTTPX
|
|
92
90
|
end
|
93
91
|
|
94
92
|
def can_buffer_more_requests?
|
95
|
-
|
93
|
+
(@handshake_completed || !@wait_for_handshake) &&
|
96
94
|
@streams.size < @max_concurrent_requests &&
|
97
|
-
|
98
|
-
else
|
99
|
-
!@wait_for_handshake &&
|
100
|
-
@streams.size < @max_concurrent_requests
|
101
|
-
end
|
95
|
+
@streams.size < @max_requests
|
102
96
|
end
|
103
97
|
|
104
98
|
def send(request)
|
@@ -116,7 +110,6 @@ module HTTPX
|
|
116
110
|
true
|
117
111
|
rescue HTTP2Next::Error::StreamLimitExceeded
|
118
112
|
@pending.unshift(request)
|
119
|
-
emit(:exhausted)
|
120
113
|
end
|
121
114
|
|
122
115
|
def consume
|
@@ -172,7 +165,6 @@ module HTTPX
|
|
172
165
|
|
173
166
|
def init_connection
|
174
167
|
@connection = HTTP2Next::Client.new(@settings)
|
175
|
-
@connection.max_streams = @max_requests if @connection.respond_to?(:max_streams=) && @max_requests.positive?
|
176
168
|
@connection.on(:frame, &method(:on_frame))
|
177
169
|
@connection.on(:frame_sent, &method(:on_frame_sent))
|
178
170
|
@connection.on(:frame_received, &method(:on_frame_received))
|
@@ -340,14 +332,7 @@ module HTTPX
|
|
340
332
|
def on_settings(*)
|
341
333
|
@handshake_completed = true
|
342
334
|
emit(:current_timeout)
|
343
|
-
|
344
|
-
if @max_requests.zero?
|
345
|
-
@max_requests = @connection.remote_settings[:settings_max_concurrent_streams]
|
346
|
-
|
347
|
-
@connection.max_streams = @max_requests if @connection.respond_to?(:max_streams=) && @max_requests.positive?
|
348
|
-
end
|
349
|
-
|
350
|
-
@max_concurrent_requests = [@max_concurrent_requests, @max_requests].min
|
335
|
+
@max_concurrent_requests = [@max_concurrent_requests, @connection.remote_settings[:settings_max_concurrent_streams]].min
|
351
336
|
send_pending
|
352
337
|
end
|
353
338
|
|
data/lib/httpx/plugins/grpc.rb
CHANGED
@@ -149,17 +149,29 @@ module HTTPX
|
|
149
149
|
deadline: @options.grpc_deadline,
|
150
150
|
}.merge(opts)
|
151
151
|
|
152
|
+
local_rpc_name = rpc_name.underscore
|
153
|
+
|
152
154
|
session_class = Class.new(self.class) do
|
155
|
+
# define rpc method with ruby style name
|
153
156
|
class_eval(<<-OUT, __FILE__, __LINE__ + 1)
|
154
|
-
def #{
|
155
|
-
rpc_execute("#{
|
156
|
-
end
|
157
|
+
def #{local_rpc_name}(input, **opts) # def grpc_action(input, **opts)
|
158
|
+
rpc_execute("#{local_rpc_name}", input, **opts) # rpc_execute("grpc_action", input, **opts)
|
159
|
+
end # end
|
157
160
|
OUT
|
161
|
+
|
162
|
+
# define rpc method with original name
|
163
|
+
unless local_rpc_name == rpc_name
|
164
|
+
class_eval(<<-OUT, __FILE__, __LINE__ + 1)
|
165
|
+
def #{rpc_name}(input, **opts) # def grpcAction(input, **opts)
|
166
|
+
rpc_execute("#{local_rpc_name}", input, **opts) # rpc_execute("grpc_action", input, **opts)
|
167
|
+
end # end
|
168
|
+
OUT
|
169
|
+
end
|
158
170
|
end
|
159
171
|
|
160
172
|
session_class.new(@options.merge(
|
161
173
|
grpc_rpcs: @options.grpc_rpcs.merge(
|
162
|
-
|
174
|
+
local_rpc_name => [rpc_name, input, output, rpc_opts]
|
163
175
|
).freeze
|
164
176
|
))
|
165
177
|
end
|
data/lib/httpx/version.rb
CHANGED
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: 1.0.
|
4
|
+
version: 1.0.2
|
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-10-
|
11
|
+
date: 2023-10-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http-2-next
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.0.
|
19
|
+
version: 1.0.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.0.
|
26
|
+
version: 1.0.1
|
27
27
|
description: A client library for making HTTP requests from Ruby.
|
28
28
|
email:
|
29
29
|
- cardoso_tiago@hotmail.com
|
@@ -106,6 +106,7 @@ extra_rdoc_files:
|
|
106
106
|
- doc/release_notes/0_24_4.md
|
107
107
|
- doc/release_notes/0_24_5.md
|
108
108
|
- doc/release_notes/0_24_6.md
|
109
|
+
- doc/release_notes/0_24_7.md
|
109
110
|
- doc/release_notes/0_2_0.md
|
110
111
|
- doc/release_notes/0_2_1.md
|
111
112
|
- doc/release_notes/0_3_0.md
|
@@ -129,6 +130,7 @@ extra_rdoc_files:
|
|
129
130
|
- doc/release_notes/0_9_0.md
|
130
131
|
- doc/release_notes/1_0_0.md
|
131
132
|
- doc/release_notes/1_0_1.md
|
133
|
+
- doc/release_notes/1_0_2.md
|
132
134
|
files:
|
133
135
|
- LICENSE.txt
|
134
136
|
- README.md
|
@@ -206,6 +208,7 @@ files:
|
|
206
208
|
- doc/release_notes/0_24_4.md
|
207
209
|
- doc/release_notes/0_24_5.md
|
208
210
|
- doc/release_notes/0_24_6.md
|
211
|
+
- doc/release_notes/0_24_7.md
|
209
212
|
- doc/release_notes/0_2_0.md
|
210
213
|
- doc/release_notes/0_2_1.md
|
211
214
|
- doc/release_notes/0_3_0.md
|
@@ -229,6 +232,7 @@ files:
|
|
229
232
|
- doc/release_notes/0_9_0.md
|
230
233
|
- doc/release_notes/1_0_0.md
|
231
234
|
- doc/release_notes/1_0_1.md
|
235
|
+
- doc/release_notes/1_0_2.md
|
232
236
|
- lib/httpx.rb
|
233
237
|
- lib/httpx/adapters/datadog.rb
|
234
238
|
- lib/httpx/adapters/faraday.rb
|