httpx 1.2.2 → 1.2.4
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_2_3.md +16 -0
- data/doc/release_notes/1_2_4.md +8 -0
- data/lib/httpx/adapters/datadog.rb +140 -45
- data/lib/httpx/altsvc.rb +2 -2
- data/lib/httpx/connection/http1.rb +1 -1
- data/lib/httpx/connection.rb +1 -1
- data/lib/httpx/plugins/auth/digest.rb +2 -1
- data/lib/httpx/plugins/aws_sigv4.rb +2 -2
- data/lib/httpx/plugins/oauth.rb +11 -7
- data/lib/httpx/plugins/retries.rb +1 -1
- data/lib/httpx/pool.rb +2 -0
- data/lib/httpx/resolver/native.rb +2 -2
- data/lib/httpx/response.rb +23 -4
- data/lib/httpx/session.rb +5 -1
- data/lib/httpx/timers.rb +4 -1
- data/lib/httpx/version.rb +1 -1
- data/sig/plugins/oauth.rbs +2 -2
- data/sig/response.rbs +1 -0
- data/sig/session.rbs +1 -1
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d5abc65b9f6377dbcefbe9170c7c47ef3555b4286c2d9c5e6e521467a75d57e
|
4
|
+
data.tar.gz: 7dfac2d6aa4ed5ecba31479ec0750de9d310657c39e12efd57f62d1544d9d1b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 720fe0c6f0883d0755122ae8009da116f7b06b0f009b56480cf3f1f80ef998e4671d6f53ce039e6d52f502c596e22fa524d6292a3372c8bd3a7f88616f6aaffc
|
7
|
+
data.tar.gz: 75fdb8eee5568a3be2fdd19a4750b18166d2eb25749a0a1cde672b0deab76d1e64c8d573665488b7d2db99d4de73f387583a75ad5a957be9529dfef4b36f11ac
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# 1.2.3
|
2
|
+
|
3
|
+
## Improvements
|
4
|
+
|
5
|
+
* `:retries` plugin: allow `:max_retries` set to 0 (allows for a soft disable of retries when using the faraday adapter).
|
6
|
+
|
7
|
+
## Bugfixes
|
8
|
+
|
9
|
+
* `:oauth` plugin: fix for default auth method being ignored when setting grant type and scope as options only.
|
10
|
+
* ensure happy eyeballs-initiated cloned connections also set session callbacks (caused issues when server would respond with a 421 response, an event requiring a valid internal callback).
|
11
|
+
* native resolver cleanly transitions from tcp to udp after truncated DNS query (causing issues on follow-up CNAME resolution).
|
12
|
+
* elapsing timeouts now guard against mutation of callbacks while looping (prevents skipping callbacks in situations where a previous one would remove itself from the collection).
|
13
|
+
|
14
|
+
## Chore
|
15
|
+
|
16
|
+
* datadog adapter: do not call `.lazy` on options (avoids deprecation warning, to be removed in ddtrace 2.0)
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# 1.2.4
|
2
|
+
|
3
|
+
## Bugfixes
|
4
|
+
|
5
|
+
* fixed issue related to inability to buffer payload to error responses (which may happen on certain error handling situations).
|
6
|
+
* fixed recovery from a lost persistent connection leaving process due to ping being sent while still marked as inactive.
|
7
|
+
* fixed datadog integration, which was not generating new spans on retried requests (when `:retries` plugin is enabled).
|
8
|
+
* fixed splitting strings into key value pairs in cases where the value would contain a "=", such as in certain base64 payloads.
|
@@ -7,6 +7,8 @@ require "datadog/tracing/contrib/patcher"
|
|
7
7
|
module Datadog::Tracing
|
8
8
|
module Contrib
|
9
9
|
module HTTPX
|
10
|
+
DATADOG_VERSION = defined?(::DDTrace) ? ::DDTrace::VERSION : ::Datadog::VERSION
|
11
|
+
|
10
12
|
METADATA_MODULE = Datadog::Tracing::Metadata
|
11
13
|
|
12
14
|
TYPE_OUTBOUND = Datadog::Tracing::Metadata::Ext::HTTP::TYPE_OUTBOUND
|
@@ -22,9 +24,10 @@ module Datadog::Tracing
|
|
22
24
|
|
23
25
|
# HTTPX Datadog Plugin
|
24
26
|
#
|
25
|
-
# Enables tracing for httpx requests.
|
26
|
-
#
|
27
|
-
#
|
27
|
+
# Enables tracing for httpx requests.
|
28
|
+
#
|
29
|
+
# A span will be created for each request transaction; the span is created lazily only when
|
30
|
+
# receiving a response, and it is fed the start time stored inside the tracer object.
|
28
31
|
#
|
29
32
|
module Plugin
|
30
33
|
class RequestTracer
|
@@ -32,82 +35,174 @@ module Datadog::Tracing
|
|
32
35
|
|
33
36
|
SPAN_REQUEST = "httpx.request"
|
34
37
|
|
38
|
+
# initializes the tracer object on the +request+.
|
35
39
|
def initialize(request)
|
36
40
|
@request = request
|
41
|
+
@start_time = nil
|
42
|
+
|
43
|
+
# request objects are reused, when already buffered requests get rerouted to a different
|
44
|
+
# connection due to connection issues, or when they already got a response, but need to
|
45
|
+
# be retried. In such situations, the original span needs to be extended for the former,
|
46
|
+
# while a new is required for the latter.
|
47
|
+
request.on(:idle) { reset }
|
48
|
+
# the span is initialized when the request is buffered in the parser, which is the closest
|
49
|
+
# one gets to actually sending the request.
|
50
|
+
request.on(:headers) { call }
|
37
51
|
end
|
38
52
|
|
39
|
-
|
40
|
-
|
53
|
+
# sets up the span start time, while preparing the on response callback.
|
54
|
+
def call(*args)
|
55
|
+
return if @start_time
|
56
|
+
|
57
|
+
start(*args)
|
58
|
+
|
59
|
+
@request.once(:response, &method(:finish))
|
60
|
+
end
|
61
|
+
|
62
|
+
private
|
63
|
+
|
64
|
+
# just sets the span init time. It can be passed a +start_time+ in cases where
|
65
|
+
# this is collected outside the request transaction.
|
66
|
+
def start(start_time = now)
|
67
|
+
@start_time = start_time
|
68
|
+
end
|
69
|
+
|
70
|
+
# resets the start time for already finished request transactions.
|
71
|
+
def reset
|
72
|
+
return unless @start_time
|
41
73
|
|
42
|
-
|
74
|
+
start
|
75
|
+
end
|
76
|
+
|
77
|
+
# creates the span from the collected +@start_time+ to what the +response+ state
|
78
|
+
# contains. It also resets internal state to allow this object to be reused.
|
79
|
+
def finish(response)
|
80
|
+
return unless @start_time
|
43
81
|
|
82
|
+
span = initialize_span
|
83
|
+
|
84
|
+
return unless span
|
85
|
+
|
86
|
+
if response.is_a?(::HTTPX::ErrorResponse)
|
87
|
+
span.set_error(response.error)
|
88
|
+
else
|
89
|
+
span.set_tag(TAG_STATUS_CODE, response.status.to_s)
|
90
|
+
|
91
|
+
span.set_error(::HTTPX::HTTPError.new(response)) if response.status >= 400 && response.status <= 599
|
92
|
+
end
|
93
|
+
|
94
|
+
span.finish
|
95
|
+
ensure
|
96
|
+
@start_time = nil
|
97
|
+
end
|
98
|
+
|
99
|
+
# return a span initialized with the +@request+ state.
|
100
|
+
def initialize_span
|
44
101
|
verb = @request.verb
|
45
102
|
uri = @request.uri
|
46
103
|
|
47
|
-
|
48
|
-
SPAN_REQUEST,
|
49
|
-
service: service_name(@request.uri.host, configuration, Datadog.configuration_for(self)),
|
50
|
-
span_type: TYPE_OUTBOUND
|
51
|
-
)
|
104
|
+
span = create_span(@request)
|
52
105
|
|
53
|
-
|
106
|
+
span.resource = verb
|
54
107
|
|
55
108
|
# Add additional request specific tags to the span.
|
56
109
|
|
57
|
-
|
58
|
-
|
110
|
+
span.set_tag(TAG_URL, @request.path)
|
111
|
+
span.set_tag(TAG_METHOD, verb)
|
59
112
|
|
60
|
-
|
61
|
-
|
113
|
+
span.set_tag(TAG_TARGET_HOST, uri.host)
|
114
|
+
span.set_tag(TAG_TARGET_PORT, uri.port.to_s)
|
62
115
|
|
63
116
|
# Tag as an external peer service
|
64
|
-
|
117
|
+
span.set_tag(TAG_PEER_SERVICE, span.service)
|
65
118
|
|
66
|
-
|
67
|
-
|
119
|
+
if configuration[:distributed_tracing]
|
120
|
+
propagate_trace_http(
|
121
|
+
Datadog::Tracing.active_trace.to_digest,
|
122
|
+
@request.headers
|
123
|
+
)
|
124
|
+
end
|
68
125
|
|
69
126
|
# Set analytics sample rate
|
70
|
-
if Contrib::Analytics.enabled?(
|
71
|
-
Contrib::Analytics.set_sample_rate(
|
127
|
+
if Contrib::Analytics.enabled?(configuration[:analytics_enabled])
|
128
|
+
Contrib::Analytics.set_sample_rate(span, configuration[:analytics_sample_rate])
|
72
129
|
end
|
130
|
+
|
131
|
+
span
|
73
132
|
rescue StandardError => e
|
74
133
|
Datadog.logger.error("error preparing span for http request: #{e}")
|
75
134
|
Datadog.logger.error(e.backtrace)
|
76
135
|
end
|
77
136
|
|
78
|
-
def
|
79
|
-
|
137
|
+
def now
|
138
|
+
::Datadog::Core::Utils::Time.now.utc
|
139
|
+
end
|
80
140
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
@span.set_tag(TAG_STATUS_CODE, response.status.to_s)
|
141
|
+
def configuration
|
142
|
+
@configuration ||= Datadog.configuration.tracing[:httpx, @request.uri.host]
|
143
|
+
end
|
85
144
|
|
86
|
-
|
145
|
+
if Gem::Version.new(DATADOG_VERSION::STRING) >= Gem::Version.new("2.0.0.beta1")
|
146
|
+
def propagate_trace_http(digest, headers)
|
147
|
+
Datadog::Tracing::Contrib::HTTP.inject(digest, headers)
|
87
148
|
end
|
88
149
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
150
|
+
def create_span(request)
|
151
|
+
Datadog::Tracing.trace(
|
152
|
+
SPAN_REQUEST,
|
153
|
+
service: service_name(request.uri.host, configuration, Datadog.configuration_for(self)),
|
154
|
+
type: TYPE_OUTBOUND,
|
155
|
+
start_time: @start_time
|
156
|
+
)
|
157
|
+
end
|
158
|
+
else
|
159
|
+
def propagate_trace_http(digest, headers)
|
160
|
+
Datadog::Tracing::Propagation::HTTP.inject!(digest, headers)
|
161
|
+
end
|
93
162
|
|
94
|
-
|
95
|
-
|
163
|
+
def create_span(request)
|
164
|
+
Datadog::Tracing.trace(
|
165
|
+
SPAN_REQUEST,
|
166
|
+
service: service_name(request.uri.host, configuration, Datadog.configuration_for(self)),
|
167
|
+
span_type: TYPE_OUTBOUND,
|
168
|
+
start_time: @start_time
|
169
|
+
)
|
170
|
+
end
|
96
171
|
end
|
97
172
|
end
|
98
173
|
|
99
174
|
module RequestMethods
|
100
|
-
|
101
|
-
|
175
|
+
# intercepts request initialization to inject the tracing logic.
|
176
|
+
def initialize(*)
|
177
|
+
super
|
178
|
+
|
179
|
+
return unless Datadog::Tracing.enabled?
|
102
180
|
|
103
|
-
RequestTracer.new(self)
|
104
|
-
@__datadog_enable_trace = true
|
181
|
+
RequestTracer.new(self)
|
105
182
|
end
|
106
183
|
end
|
107
184
|
|
108
185
|
module ConnectionMethods
|
109
|
-
|
110
|
-
|
186
|
+
attr_reader :init_time
|
187
|
+
|
188
|
+
def initialize(*)
|
189
|
+
super
|
190
|
+
|
191
|
+
@init_time = ::Datadog::Core::Utils::Time.now.utc
|
192
|
+
end
|
193
|
+
|
194
|
+
# handles the case when the +error+ happened during name resolution, which meanns
|
195
|
+
# that the tracing logic hasn't been injected yet; in such cases, the approximate
|
196
|
+
# initial resolving time is collected from the connection, and used as span start time,
|
197
|
+
# and the tracing object in inserted before the on response callback is called.
|
198
|
+
def handle_error(error)
|
199
|
+
return super unless Datadog::Tracing.enabled?
|
200
|
+
|
201
|
+
return super unless error.respond_to?(:connection)
|
202
|
+
|
203
|
+
@pending.each do |request|
|
204
|
+
RequestTracer.new(request).call(error.connection.init_time)
|
205
|
+
end
|
111
206
|
|
112
207
|
super
|
113
208
|
end
|
@@ -126,7 +221,7 @@ module Datadog::Tracing
|
|
126
221
|
option :distributed_tracing, default: true
|
127
222
|
option :split_by_domain, default: false
|
128
223
|
|
129
|
-
if Gem::Version.new(
|
224
|
+
if Gem::Version.new(DATADOG_VERSION::STRING) >= Gem::Version.new("1.13.0")
|
130
225
|
option :enabled do |o|
|
131
226
|
o.type :bool
|
132
227
|
o.env "DD_TRACE_HTTPX_ENABLED"
|
@@ -169,25 +264,25 @@ module Datadog::Tracing
|
|
169
264
|
"httpx"
|
170
265
|
)
|
171
266
|
end
|
172
|
-
o.lazy
|
267
|
+
o.lazy unless Gem::Version.new(DATADOG_VERSION::STRING) >= Gem::Version.new("1.13.0")
|
173
268
|
end
|
174
269
|
else
|
175
270
|
option :service_name do |o|
|
176
271
|
o.default do
|
177
272
|
ENV.fetch("DD_TRACE_HTTPX_SERVICE_NAME", "httpx")
|
178
273
|
end
|
179
|
-
o.lazy
|
274
|
+
o.lazy unless Gem::Version.new(DATADOG_VERSION::STRING) >= Gem::Version.new("1.13.0")
|
180
275
|
end
|
181
276
|
end
|
182
277
|
|
183
278
|
option :distributed_tracing, default: true
|
184
279
|
|
185
|
-
if Gem::Version.new(
|
280
|
+
if Gem::Version.new(DATADOG_VERSION::STRING) >= Gem::Version.new("1.15.0")
|
186
281
|
option :error_handler do |o|
|
187
282
|
o.type :proc
|
188
283
|
o.default_proc(&DEFAULT_ERROR_HANDLER)
|
189
284
|
end
|
190
|
-
elsif Gem::Version.new(
|
285
|
+
elsif Gem::Version.new(DATADOG_VERSION::STRING) >= Gem::Version.new("1.13.0")
|
191
286
|
option :error_handler do |o|
|
192
287
|
o.type :proc
|
193
288
|
o.experimental_default_proc(&DEFAULT_ERROR_HANDLER)
|
data/lib/httpx/altsvc.rb
CHANGED
@@ -131,9 +131,9 @@ module HTTPX
|
|
131
131
|
scanner.skip(/;/)
|
132
132
|
break if scanner.eos? || scanner.scan(/ *, */)
|
133
133
|
end
|
134
|
-
alt_params = Hash[alt_params.map { |field| field.split("=") }]
|
134
|
+
alt_params = Hash[alt_params.map { |field| field.split("=", 2) }]
|
135
135
|
|
136
|
-
alt_proto, alt_authority = alt_service.split("=")
|
136
|
+
alt_proto, alt_authority = alt_service.split("=", 2)
|
137
137
|
alt_origin = parse_altsvc_origin(alt_proto, alt_authority)
|
138
138
|
return unless alt_origin
|
139
139
|
|
data/lib/httpx/connection.rb
CHANGED
@@ -241,8 +241,8 @@ module HTTPX
|
|
241
241
|
# for such cases, we want to ping for availability before deciding to shovel requests.
|
242
242
|
log(level: 3) { "keep alive timeout expired, pinging connection..." }
|
243
243
|
@pending << request
|
244
|
-
parser.ping
|
245
244
|
transition(:active) if @state == :inactive
|
245
|
+
parser.ping
|
246
246
|
return
|
247
247
|
end
|
248
248
|
|
@@ -30,7 +30,8 @@ module HTTPX
|
|
30
30
|
auth_info = authenticate[/^(\w+) (.*)/, 2]
|
31
31
|
|
32
32
|
params = auth_info.split(/ *, */)
|
33
|
-
.to_h { |val| val.split("="
|
33
|
+
.to_h { |val| val.split("=", 2) }
|
34
|
+
.transform_values { |v| v.delete("\"") }
|
34
35
|
nonce = params["nonce"]
|
35
36
|
nc = next_nonce
|
36
37
|
|
@@ -197,8 +197,8 @@ module HTTPX
|
|
197
197
|
params.each.with_index.sort do |a, b|
|
198
198
|
a, a_offset = a
|
199
199
|
b, b_offset = b
|
200
|
-
a_name, a_value = a.split("=")
|
201
|
-
b_name, b_value = b.split("=")
|
200
|
+
a_name, a_value = a.split("=", 2)
|
201
|
+
b_name, b_value = b.split("=", 2)
|
202
202
|
if a_name == b_name
|
203
203
|
if a_value == b_value
|
204
204
|
a_offset <=> b_offset
|
data/lib/httpx/plugins/oauth.rb
CHANGED
@@ -16,7 +16,7 @@ module HTTPX
|
|
16
16
|
SUPPORTED_AUTH_METHODS = %w[client_secret_basic client_secret_post].freeze
|
17
17
|
|
18
18
|
class OAuthSession
|
19
|
-
attr_reader :
|
19
|
+
attr_reader :grant_type, :client_id, :client_secret, :access_token, :refresh_token, :scope
|
20
20
|
|
21
21
|
def initialize(
|
22
22
|
issuer:,
|
@@ -28,7 +28,7 @@ module HTTPX
|
|
28
28
|
token_endpoint: nil,
|
29
29
|
response_type: nil,
|
30
30
|
grant_type: nil,
|
31
|
-
token_endpoint_auth_method:
|
31
|
+
token_endpoint_auth_method: nil
|
32
32
|
)
|
33
33
|
@issuer = URI(issuer)
|
34
34
|
@client_id = client_id
|
@@ -43,10 +43,10 @@ module HTTPX
|
|
43
43
|
end
|
44
44
|
@access_token = access_token
|
45
45
|
@refresh_token = refresh_token
|
46
|
-
@token_endpoint_auth_method = String(token_endpoint_auth_method)
|
46
|
+
@token_endpoint_auth_method = String(token_endpoint_auth_method) if token_endpoint_auth_method
|
47
47
|
@grant_type = grant_type || (@refresh_token ? "refresh_token" : "client_credentials")
|
48
48
|
|
49
|
-
unless SUPPORTED_AUTH_METHODS.include?(@token_endpoint_auth_method)
|
49
|
+
unless @token_endpoint_auth_method.nil? || SUPPORTED_AUTH_METHODS.include?(@token_endpoint_auth_method)
|
50
50
|
raise Error, "#{@token_endpoint_auth_method} is not a supported auth method"
|
51
51
|
end
|
52
52
|
|
@@ -59,8 +59,12 @@ module HTTPX
|
|
59
59
|
@token_endpoint || "#{@issuer}/token"
|
60
60
|
end
|
61
61
|
|
62
|
+
def token_endpoint_auth_method
|
63
|
+
@token_endpoint_auth_method || "client_secret_basic"
|
64
|
+
end
|
65
|
+
|
62
66
|
def load(http)
|
63
|
-
return if @
|
67
|
+
return if @grant_type && @scope
|
64
68
|
|
65
69
|
metadata = http.get("#{@issuer}/.well-known/oauth-authorization-server").raise_for_status.json
|
66
70
|
|
@@ -123,11 +127,11 @@ module HTTPX
|
|
123
127
|
|
124
128
|
# auth
|
125
129
|
case oauth_session.token_endpoint_auth_method
|
126
|
-
when "client_secret_basic"
|
127
|
-
headers["authorization"] = Authentication::Basic.new(oauth_session.client_id, oauth_session.client_secret).authenticate
|
128
130
|
when "client_secret_post"
|
129
131
|
form_post["client_id"] = oauth_session.client_id
|
130
132
|
form_post["client_secret"] = oauth_session.client_secret
|
133
|
+
when "client_secret_basic"
|
134
|
+
headers["authorization"] = Authentication::Basic.new(oauth_session.client_id, oauth_session.client_secret).authenticate
|
131
135
|
end
|
132
136
|
|
133
137
|
case grant_type
|
data/lib/httpx/pool.rb
CHANGED
@@ -179,6 +179,7 @@ module HTTPX
|
|
179
179
|
connection.once(:connect_error) do |err|
|
180
180
|
if new_connection.connecting?
|
181
181
|
new_connection.merge(connection)
|
182
|
+
connection.emit(:cloned, new_connection)
|
182
183
|
connection.force_reset
|
183
184
|
else
|
184
185
|
connection.__send__(:handle_error, err)
|
@@ -195,6 +196,7 @@ module HTTPX
|
|
195
196
|
if connection.connecting?
|
196
197
|
# main connection has the requests
|
197
198
|
connection.merge(new_connection)
|
199
|
+
new_connection.emit(:cloned, connection)
|
198
200
|
new_connection.force_reset
|
199
201
|
else
|
200
202
|
new_connection.__send__(:handle_error, err)
|
@@ -187,10 +187,10 @@ module HTTPX
|
|
187
187
|
next unless @large_packet.full?
|
188
188
|
|
189
189
|
parse(@large_packet.to_s)
|
190
|
-
|
191
190
|
@socket_type = @resolver_options.fetch(:socket_type, :udp)
|
192
191
|
@large_packet = nil
|
193
|
-
transition(:
|
192
|
+
transition(:idle)
|
193
|
+
transition(:open)
|
194
194
|
return
|
195
195
|
else
|
196
196
|
size = @read_buffer[0, 2].unpack1("n")
|
data/lib/httpx/response.rb
CHANGED
@@ -7,10 +7,18 @@ require "fileutils"
|
|
7
7
|
require "forwardable"
|
8
8
|
|
9
9
|
module HTTPX
|
10
|
-
# Defines a HTTP response is handled internally, with a few properties exposed as attributes
|
11
|
-
#
|
12
|
-
#
|
10
|
+
# Defines a HTTP response is handled internally, with a few properties exposed as attributes.
|
11
|
+
#
|
12
|
+
# It delegates the following methods to the corresponding HTTPX::Request:
|
13
|
+
#
|
14
|
+
# * HTTPX::Request#uri
|
15
|
+
# * HTTPX::Request#peer_address
|
16
|
+
#
|
17
|
+
# It implements (indirectly, via the +body+) the IO write protocol to internally buffer payloads.
|
18
|
+
#
|
19
|
+
# It implements the IO reader protocol in order for users to buffer/stream it, acts as an enumerable
|
13
20
|
# (of payload chunks).
|
21
|
+
#
|
14
22
|
class Response
|
15
23
|
extend Forwardable
|
16
24
|
include Callbacks
|
@@ -21,7 +29,13 @@ module HTTPX
|
|
21
29
|
# an HTTPX::Headers object containing the response HTTP headers.
|
22
30
|
attr_reader :headers
|
23
31
|
|
24
|
-
# a HTTPX::Response::Body object wrapping the response body.
|
32
|
+
# a HTTPX::Response::Body object wrapping the response body. The following methods are delegated to it:
|
33
|
+
#
|
34
|
+
# * HTTPX::Response::Body#to_s
|
35
|
+
# * HTTPX::Response::Body#to_str
|
36
|
+
# * HTTPX::Response::Body#read
|
37
|
+
# * HTTPX::Response::Body#copy_to
|
38
|
+
# * HTTPX::Response::Body#close
|
25
39
|
attr_reader :body
|
26
40
|
|
27
41
|
# The HTTP protocol version used to fetch the response.
|
@@ -260,6 +274,11 @@ module HTTPX
|
|
260
274
|
def raise_for_status
|
261
275
|
raise @error
|
262
276
|
end
|
277
|
+
|
278
|
+
# buffers lost chunks to error response
|
279
|
+
def <<(data)
|
280
|
+
@response << data
|
281
|
+
end
|
263
282
|
end
|
264
283
|
end
|
265
284
|
|
data/lib/httpx/session.rb
CHANGED
@@ -138,7 +138,7 @@ module HTTPX
|
|
138
138
|
|
139
139
|
# sets the callbacks on the +connection+ required to process certain specific
|
140
140
|
# connection lifecycle events which deal with request rerouting.
|
141
|
-
def set_connection_callbacks(connection, connections, options)
|
141
|
+
def set_connection_callbacks(connection, connections, options, cloned: false)
|
142
142
|
connection.only(:misdirected) do |misdirected_request|
|
143
143
|
other_connection = connection.create_idle(ssl: { alpn_protocols: %w[http/1.1] })
|
144
144
|
other_connection.merge(connection)
|
@@ -154,6 +154,10 @@ module HTTPX
|
|
154
154
|
other_connection = build_altsvc_connection(connection, connections, alt_origin, origin, alt_params, options)
|
155
155
|
connections << other_connection if other_connection
|
156
156
|
end
|
157
|
+
connection.only(:cloned) do |cloned_conn|
|
158
|
+
set_connection_callbacks(cloned_conn, connections, options, cloned: true)
|
159
|
+
connections << cloned_conn
|
160
|
+
end unless cloned
|
157
161
|
end
|
158
162
|
|
159
163
|
# returns an HTTPX::Connection for the negotiated Alternative Service (or none).
|
data/lib/httpx/timers.rb
CHANGED
data/lib/httpx/version.rb
CHANGED
data/sig/plugins/oauth.rbs
CHANGED
@@ -15,8 +15,6 @@ module HTTPX
|
|
15
15
|
SUPPORTED_AUTH_METHODS: ::Array[token_auth_method]
|
16
16
|
|
17
17
|
class OAuthSession
|
18
|
-
attr_reader token_endpoint_auth_method: token_auth_method
|
19
|
-
|
20
18
|
attr_reader grant_type: grant_type
|
21
19
|
|
22
20
|
attr_reader client_id: String
|
@@ -33,6 +31,8 @@ module HTTPX
|
|
33
31
|
|
34
32
|
def token_endpoint: () -> String
|
35
33
|
|
34
|
+
def token_endpoint_auth_method: () -> token_auth_method
|
35
|
+
|
36
36
|
def load: (Session http) -> void
|
37
37
|
|
38
38
|
def merge: (instance | Hash[untyped, untyped] other) -> instance
|
data/sig/response.rbs
CHANGED
data/sig/session.rbs
CHANGED
@@ -31,7 +31,7 @@ module HTTPX
|
|
31
31
|
|
32
32
|
def send_request: (Request request, Array[Connection] connections, ?Options options) -> void
|
33
33
|
|
34
|
-
def set_connection_callbacks: (Connection connection, Array[Connection] connections, Options options) -> void
|
34
|
+
def set_connection_callbacks: (Connection connection, Array[Connection] connections, Options options, ?cloned: bool) -> void
|
35
35
|
|
36
36
|
def set_request_callbacks: (Request request) -> void
|
37
37
|
|
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.2.
|
4
|
+
version: 1.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tiago Cardoso
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-04-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http-2-next
|
@@ -140,6 +140,8 @@ extra_rdoc_files:
|
|
140
140
|
- doc/release_notes/1_2_0.md
|
141
141
|
- doc/release_notes/1_2_1.md
|
142
142
|
- doc/release_notes/1_2_2.md
|
143
|
+
- doc/release_notes/1_2_3.md
|
144
|
+
- doc/release_notes/1_2_4.md
|
143
145
|
files:
|
144
146
|
- LICENSE.txt
|
145
147
|
- README.md
|
@@ -251,6 +253,8 @@ files:
|
|
251
253
|
- doc/release_notes/1_2_0.md
|
252
254
|
- doc/release_notes/1_2_1.md
|
253
255
|
- doc/release_notes/1_2_2.md
|
256
|
+
- doc/release_notes/1_2_3.md
|
257
|
+
- doc/release_notes/1_2_4.md
|
254
258
|
- lib/httpx.rb
|
255
259
|
- lib/httpx/adapters/datadog.rb
|
256
260
|
- lib/httpx/adapters/faraday.rb
|