httpx 0.24.0 → 0.24.1
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_1.md +12 -0
- data/lib/httpx/adapters/datadog.rb +22 -1
- data/lib/httpx/domain_name.rb +1 -1
- data/lib/httpx/plugins/proxy/http.rb +6 -0
- data/lib/httpx/plugins/proxy/socks4.rb +6 -0
- data/lib/httpx/plugins/proxy/socks5.rb +8 -2
- data/lib/httpx/plugins/proxy.rb +25 -4
- data/lib/httpx/session_extensions.rb +4 -1
- data/lib/httpx/version.rb +1 -1
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 588deec0af9ead32480f7cca9ce8c278b344ccdd2e608cc2a6a8db8c6135647f
|
4
|
+
data.tar.gz: 3b69af49050cd6ba7b0317ddcd2286cbe6a2261add9fd0b9839bb89290e3962a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e630447fb6bc2aabb6efd842fdd322734e78e7859ea03126ab3d45cf4580d91ede945aa4e77700ae6cbe92179cc0a7e96fdc294ccaf729b287c4b4269b9b40b8
|
7
|
+
data.tar.gz: 138310fead4041c202f32b3e53564023472383f5cc251c59cc88b115c8f2947801da8269518d3dce48ff8b53abe3b1350d92b553a9264be8ab052064a135b605
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# 0.24.1
|
2
|
+
|
3
|
+
## Improvements
|
4
|
+
|
5
|
+
* datadog adapter: support `:service_name` configuration option.
|
6
|
+
* datadog adapter: set `:distributed_tracing` to `true` by default.
|
7
|
+
* `:proxy` plugin: when the proxy uri uses an unsupported scheme (i.e.: "scp://125.24.2.1"), a more user friendly error is raised (instead of the previous broken stacktrace).
|
8
|
+
|
9
|
+
## Bugfixes
|
10
|
+
|
11
|
+
* datadog adapter: fix tracing enable call, which was wrongly calling `super`.
|
12
|
+
+ `:proxy` plugin: fix for bug which was turning off plugins overriding `HTTPX::Connection#send` (such as the datadog adapter).
|
@@ -160,7 +160,7 @@ module TRACING_MODULE # rubocop:disable Naming/ClassAndModuleCamelCase
|
|
160
160
|
|
161
161
|
module RequestMethods
|
162
162
|
def __datadog_enable_trace!
|
163
|
-
return
|
163
|
+
return if @__datadog_enable_trace
|
164
164
|
|
165
165
|
RequestTracer.new(self).call
|
166
166
|
@__datadog_enable_trace = true
|
@@ -203,6 +203,27 @@ module TRACING_MODULE # rubocop:disable Naming/ClassAndModuleCamelCase
|
|
203
203
|
o.lazy
|
204
204
|
end
|
205
205
|
|
206
|
+
if defined?(TRACING_MODULE::Contrib::SpanAttributeSchema)
|
207
|
+
option :service_name do |o|
|
208
|
+
o.default do
|
209
|
+
TRACING_MODULE::Contrib::SpanAttributeSchema.fetch_service_name(
|
210
|
+
"DD_TRACE_HTTPX_SERVICE_NAME",
|
211
|
+
"httpx"
|
212
|
+
)
|
213
|
+
end
|
214
|
+
o.lazy
|
215
|
+
end
|
216
|
+
else
|
217
|
+
option :service_name do |o|
|
218
|
+
o.default do
|
219
|
+
ENV.fetch("DD_TRACE_HTTPX_SERVICE_NAME", "httpx")
|
220
|
+
end
|
221
|
+
o.lazy
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
option :distributed_tracing, default: true
|
226
|
+
|
206
227
|
option :error_handler, default: DEFAULT_ERROR_HANDLER
|
207
228
|
end
|
208
229
|
end
|
data/lib/httpx/domain_name.rb
CHANGED
@@ -63,7 +63,7 @@ module HTTPX
|
|
63
63
|
# Normalizes a _domain_ using the Punycode algorithm as necessary.
|
64
64
|
# The result will be a downcased, ASCII-only string.
|
65
65
|
def normalize(domain)
|
66
|
-
domain = domain.
|
66
|
+
domain = domain.chomp(DOT).unicode_normalize(:nfc) unless domain.ascii_only?
|
67
67
|
Punycode.encode_hostname(domain).downcase
|
68
68
|
end
|
69
69
|
end
|
@@ -6,6 +6,12 @@ module HTTPX
|
|
6
6
|
module Plugins
|
7
7
|
module Proxy
|
8
8
|
module HTTP
|
9
|
+
class << self
|
10
|
+
def extra_options(options)
|
11
|
+
options.merge(supported_proxy_protocols: options.supported_proxy_protocols + %w[http])
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
9
15
|
module InstanceMethods
|
10
16
|
def with_proxy_basic_auth(opts)
|
11
17
|
with(proxy: opts.merge(scheme: "basic"))
|
@@ -16,6 +16,12 @@ module HTTPX
|
|
16
16
|
|
17
17
|
Error = Socks4Error
|
18
18
|
|
19
|
+
class << self
|
20
|
+
def extra_options(options)
|
21
|
+
options.merge(supported_proxy_protocols: options.supported_proxy_protocols + PROTOCOLS)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
19
25
|
module ConnectionMethods
|
20
26
|
def interests
|
21
27
|
if @state == :connecting
|
@@ -18,8 +18,14 @@ module HTTPX
|
|
18
18
|
|
19
19
|
Error = Socks5Error
|
20
20
|
|
21
|
-
|
22
|
-
|
21
|
+
class << self
|
22
|
+
def load_dependencies(*)
|
23
|
+
require_relative "../authentication/socks5"
|
24
|
+
end
|
25
|
+
|
26
|
+
def extra_options(options)
|
27
|
+
options.merge(supported_proxy_protocols: options.supported_proxy_protocols + %w[socks5])
|
28
|
+
end
|
23
29
|
end
|
24
30
|
|
25
31
|
module ConnectionMethods
|
data/lib/httpx/plugins/proxy.rb
CHANGED
@@ -25,6 +25,10 @@ module HTTPX
|
|
25
25
|
klass.plugin(:"proxy/socks5")
|
26
26
|
end
|
27
27
|
|
28
|
+
def extra_options(options)
|
29
|
+
options.merge(supported_proxy_protocols: [])
|
30
|
+
end
|
31
|
+
|
28
32
|
if URI::Generic.methods.include?(:use_proxy?)
|
29
33
|
def use_proxy?(*args)
|
30
34
|
URI::Generic.use_proxy?(*args)
|
@@ -118,6 +122,12 @@ module HTTPX
|
|
118
122
|
def option_proxy(value)
|
119
123
|
value.is_a?(Parameters) ? value : Hash[value]
|
120
124
|
end
|
125
|
+
|
126
|
+
def option_supported_proxy_protocols(value)
|
127
|
+
raise TypeError, ":supported_proxy_protocols must be an Array" unless value.is_a?(Array)
|
128
|
+
|
129
|
+
value.map(&:to_s)
|
130
|
+
end
|
121
131
|
end
|
122
132
|
|
123
133
|
module InstanceMethods
|
@@ -142,8 +152,12 @@ module HTTPX
|
|
142
152
|
next_proxy = @_proxy_uris.first
|
143
153
|
raise Error, "Failed to connect to proxy" unless next_proxy
|
144
154
|
|
155
|
+
next_proxy = URI(next_proxy)
|
156
|
+
|
157
|
+
raise Error,
|
158
|
+
"#{next_proxy.scheme}: unsupported proxy protocol" unless options.supported_proxy_protocols.include?(next_proxy.scheme)
|
159
|
+
|
145
160
|
if proxy.key?(:no_proxy)
|
146
|
-
next_proxy = URI(next_proxy)
|
147
161
|
|
148
162
|
no_proxy = proxy[:no_proxy]
|
149
163
|
no_proxy = no_proxy.join(",") if no_proxy.is_a?(Array)
|
@@ -253,10 +267,11 @@ module HTTPX
|
|
253
267
|
end
|
254
268
|
|
255
269
|
def send(request)
|
256
|
-
return super unless
|
257
|
-
|
270
|
+
return super unless (
|
271
|
+
@options.proxy && @state != :idle && connecting?
|
272
|
+
)
|
258
273
|
|
259
|
-
@
|
274
|
+
(@proxy_pending ||= []) << request
|
260
275
|
end
|
261
276
|
|
262
277
|
def connecting?
|
@@ -294,6 +309,12 @@ module HTTPX
|
|
294
309
|
when :idle
|
295
310
|
transition(:connecting)
|
296
311
|
when :connected
|
312
|
+
if @proxy_pending
|
313
|
+
while (req = @proxy_pendind.shift)
|
314
|
+
send(req)
|
315
|
+
end
|
316
|
+
end
|
317
|
+
|
297
318
|
transition(:open)
|
298
319
|
end
|
299
320
|
end
|
@@ -9,10 +9,13 @@ module HTTPX
|
|
9
9
|
# redefine the default options static var, which needs to
|
10
10
|
# refresh options_class
|
11
11
|
options = proxy_session.class.default_options.to_hash
|
12
|
-
options.freeze
|
13
12
|
original_verbosity = $VERBOSE
|
14
13
|
$VERBOSE = nil
|
14
|
+
const_set(:Options, proxy_session.class.default_options.options_class)
|
15
|
+
options[:options_class] = Class.new(options[:options_class])
|
16
|
+
options.freeze
|
15
17
|
Options.send(:const_set, :DEFAULT_OPTIONS, options)
|
18
|
+
Session.instance_variable_set(:@default_options, Options.new(options))
|
16
19
|
$VERBOSE = original_verbosity
|
17
20
|
end
|
18
21
|
|
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: 0.24.
|
4
|
+
version: 0.24.1
|
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-06-
|
11
|
+
date: 2023-06-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http-2-next
|
@@ -100,6 +100,7 @@ extra_rdoc_files:
|
|
100
100
|
- doc/release_notes/0_23_3.md
|
101
101
|
- doc/release_notes/0_23_4.md
|
102
102
|
- doc/release_notes/0_24_0.md
|
103
|
+
- doc/release_notes/0_24_1.md
|
103
104
|
- doc/release_notes/0_2_0.md
|
104
105
|
- doc/release_notes/0_2_1.md
|
105
106
|
- doc/release_notes/0_3_0.md
|
@@ -192,6 +193,7 @@ files:
|
|
192
193
|
- doc/release_notes/0_23_3.md
|
193
194
|
- doc/release_notes/0_23_4.md
|
194
195
|
- doc/release_notes/0_24_0.md
|
196
|
+
- doc/release_notes/0_24_1.md
|
195
197
|
- doc/release_notes/0_2_0.md
|
196
198
|
- doc/release_notes/0_2_1.md
|
197
199
|
- doc/release_notes/0_3_0.md
|
@@ -392,7 +394,7 @@ metadata:
|
|
392
394
|
changelog_uri: https://os85.gitlab.io/httpx/#release-notes
|
393
395
|
documentation_uri: https://os85.gitlab.io/httpx/rdoc/
|
394
396
|
source_code_uri: https://gitlab.com/os85/httpx
|
395
|
-
homepage_uri: https://
|
397
|
+
homepage_uri: https://honeyryderchuck.gitlab.io/httpx/
|
396
398
|
rubygems_mfa_required: 'true'
|
397
399
|
post_install_message:
|
398
400
|
rdoc_options: []
|
@@ -409,7 +411,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
409
411
|
- !ruby/object:Gem::Version
|
410
412
|
version: '0'
|
411
413
|
requirements: []
|
412
|
-
rubygems_version: 3.4.
|
414
|
+
rubygems_version: 3.4.10
|
413
415
|
signing_key:
|
414
416
|
specification_version: 4
|
415
417
|
summary: HTTPX, to the future, and beyond
|