httpx 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/doc/release_notes/1_2_2.md +10 -0
- data/lib/httpx/connection.rb +3 -2
- data/lib/httpx/io/tcp.rb +2 -1
- data/lib/httpx/options.rb +7 -8
- data/lib/httpx/plugins/oauth.rb +3 -2
- data/lib/httpx/pool.rb +11 -0
- data/lib/httpx/request.rb +1 -1
- data/lib/httpx/session.rb +9 -7
- data/lib/httpx/version.rb +1 -1
- data/sig/pool.rbs +2 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7aff2acc77577cb1243c30a63766f404755131c2f1b19162b9b6ba13c49d61f8
|
4
|
+
data.tar.gz: 6297b0857edce0f5d93a0272c2b5e891257969c36cbf0c34c6a7ca6e4a5ced67
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94da91dd14a8318e8f0a0199214f97c008b927c7b8d9f602f045434bbd375b4446c767ed805e424d826c3dc48e90a8a0fded192858d32763c4c38033e0107cae
|
7
|
+
data.tar.gz: 657cefe9a977ca56dddda02bbdb07a94b4a8f158193e5f0d695c254bdbcafd95ffccd29641d38958d16468a81fd236f4d95ef4487c335cf7e079fb29b8d456ba
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# 1.2.2
|
2
|
+
|
3
|
+
## Bugfixes
|
4
|
+
|
5
|
+
* only raise "unknown option" error when option is not supported, not anymore when error happens in the setup of a support option.
|
6
|
+
* usage of `HTTPX::Session#wrap` within a thread with other sessions using the `:persistent` plugin won't inadvertedly terminate its open connections.
|
7
|
+
* terminate connections on `IOError` (`SocketError` does not cover them).
|
8
|
+
* terminate connections on HTTP/2 protocol and handshake errors, which happen during establishment or termination of a HTTP/2 connection (they were being previously kept around, although they'd irrecoverable).
|
9
|
+
* `:oauth` plugin: fixing check preventing the OAuth metadata server integration path to be exercised.
|
10
|
+
* fix instantiation of the options headers object with the wrong headers class.
|
data/lib/httpx/connection.rb
CHANGED
@@ -522,14 +522,15 @@ module HTTPX
|
|
522
522
|
Errno::ENETUNREACH,
|
523
523
|
Errno::EPIPE,
|
524
524
|
Errno::ENOENT,
|
525
|
-
SocketError
|
525
|
+
SocketError,
|
526
|
+
IOError => e
|
526
527
|
# connect errors, exit gracefully
|
527
528
|
error = ConnectionError.new(e.message)
|
528
529
|
error.set_backtrace(e.backtrace)
|
529
530
|
connecting? && callbacks_for?(:connect_error) ? emit(:connect_error, error) : handle_error(error)
|
530
531
|
@state = :closed
|
531
532
|
emit(:close)
|
532
|
-
rescue TLSError => e
|
533
|
+
rescue TLSError, HTTP2Next::Error::ProtocolError, HTTP2Next::Error::HandshakeError => e
|
533
534
|
# connect errors, exit gracefully
|
534
535
|
handle_error(e)
|
535
536
|
connecting? && callbacks_for?(:connect_error) ? emit(:connect_error, e) : handle_error(e)
|
data/lib/httpx/io/tcp.rb
CHANGED
data/lib/httpx/options.rb
CHANGED
@@ -47,13 +47,13 @@ module HTTPX
|
|
47
47
|
write_timeout: WRITE_TIMEOUT,
|
48
48
|
request_timeout: REQUEST_TIMEOUT,
|
49
49
|
},
|
50
|
+
:headers_class => Class.new(Headers),
|
50
51
|
:headers => {},
|
51
52
|
:window_size => WINDOW_SIZE,
|
52
53
|
:buffer_size => BUFFER_SIZE,
|
53
54
|
:body_threshold_size => MAX_BODY_THRESHOLD_SIZE,
|
54
55
|
:request_class => Class.new(Request),
|
55
56
|
:response_class => Class.new(Response),
|
56
|
-
:headers_class => Class.new(Headers),
|
57
57
|
:request_body_class => Class.new(Request::Body),
|
58
58
|
:response_body_class => Class.new(Response::Body),
|
59
59
|
:connection_class => Class.new(Connection),
|
@@ -154,7 +154,7 @@ module HTTPX
|
|
154
154
|
end
|
155
155
|
|
156
156
|
def option_headers(value)
|
157
|
-
|
157
|
+
headers_class.new(value)
|
158
158
|
end
|
159
159
|
|
160
160
|
def option_timeout(value)
|
@@ -342,12 +342,11 @@ module HTTPX
|
|
342
342
|
defaults.each do |k, v|
|
343
343
|
next if v.nil?
|
344
344
|
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
end
|
345
|
+
option_method_name = :"option_#{k}"
|
346
|
+
raise Error, "unknown option: #{k}" unless respond_to?(option_method_name)
|
347
|
+
|
348
|
+
value = __send__(option_method_name, v)
|
349
|
+
instance_variable_set(:"@#{k}", value)
|
351
350
|
end
|
352
351
|
end
|
353
352
|
end
|
data/lib/httpx/plugins/oauth.rb
CHANGED
@@ -60,9 +60,9 @@ module HTTPX
|
|
60
60
|
end
|
61
61
|
|
62
62
|
def load(http)
|
63
|
-
return
|
63
|
+
return if @token_endpoint_auth_method && @grant_type && @scope
|
64
64
|
|
65
|
-
metadata = http.get("#{issuer}/.well-known/oauth-authorization-server").raise_for_status.json
|
65
|
+
metadata = http.get("#{@issuer}/.well-known/oauth-authorization-server").raise_for_status.json
|
66
66
|
|
67
67
|
@token_endpoint = metadata["token_endpoint"]
|
68
68
|
@scope = metadata["scopes_supported"]
|
@@ -70,6 +70,7 @@ module HTTPX
|
|
70
70
|
@token_endpoint_auth_method = Array(metadata["token_endpoint_auth_methods_supported"]).find do |am|
|
71
71
|
SUPPORTED_AUTH_METHODS.include?(am)
|
72
72
|
end
|
73
|
+
nil
|
73
74
|
end
|
74
75
|
|
75
76
|
def merge(other)
|
data/lib/httpx/pool.rb
CHANGED
@@ -19,6 +19,17 @@ module HTTPX
|
|
19
19
|
@connections = []
|
20
20
|
end
|
21
21
|
|
22
|
+
def wrap
|
23
|
+
connections = @connections
|
24
|
+
@connections = []
|
25
|
+
|
26
|
+
begin
|
27
|
+
yield self
|
28
|
+
ensure
|
29
|
+
@connections.unshift(*connections)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
22
33
|
def empty?
|
23
34
|
@connections.empty?
|
24
35
|
end
|
data/lib/httpx/request.rb
CHANGED
data/lib/httpx/session.rb
CHANGED
@@ -28,13 +28,15 @@ module HTTPX
|
|
28
28
|
# http.get("https://wikipedia.com")
|
29
29
|
# end # wikipedia connection closes here
|
30
30
|
def wrap
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
31
|
+
prev_persistent = @persistent
|
32
|
+
@persistent = true
|
33
|
+
pool.wrap do
|
34
|
+
begin
|
35
|
+
yield self
|
36
|
+
ensure
|
37
|
+
@persistent = prev_persistent
|
38
|
+
close unless @persistent
|
39
|
+
end
|
38
40
|
end
|
39
41
|
end
|
40
42
|
|
data/lib/httpx/version.rb
CHANGED
data/sig/pool.rbs
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.2.
|
4
|
+
version: 1.2.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: 2024-
|
11
|
+
date: 2024-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http-2-next
|
@@ -139,6 +139,7 @@ extra_rdoc_files:
|
|
139
139
|
- doc/release_notes/1_1_5.md
|
140
140
|
- doc/release_notes/1_2_0.md
|
141
141
|
- doc/release_notes/1_2_1.md
|
142
|
+
- doc/release_notes/1_2_2.md
|
142
143
|
files:
|
143
144
|
- LICENSE.txt
|
144
145
|
- README.md
|
@@ -249,6 +250,7 @@ files:
|
|
249
250
|
- doc/release_notes/1_1_5.md
|
250
251
|
- doc/release_notes/1_2_0.md
|
251
252
|
- doc/release_notes/1_2_1.md
|
253
|
+
- doc/release_notes/1_2_2.md
|
252
254
|
- lib/httpx.rb
|
253
255
|
- lib/httpx/adapters/datadog.rb
|
254
256
|
- lib/httpx/adapters/faraday.rb
|