httpx 0.14.5 → 0.15.0
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_13_2.md +1 -1
- data/doc/release_notes/0_15_0.md +44 -0
- data/lib/httpx.rb +1 -0
- data/lib/httpx/connection.rb +12 -3
- data/lib/httpx/connection/http1.rb +4 -0
- data/lib/httpx/connection/http2.rb +14 -0
- data/lib/httpx/domain_name.rb +0 -290
- data/lib/httpx/errors.rb +2 -0
- data/lib/httpx/extensions.rb +1 -1
- data/lib/httpx/options.rb +2 -0
- data/lib/httpx/plugins/digest_authentication.rb +19 -21
- data/lib/httpx/plugins/grpc.rb +1 -1
- data/lib/httpx/plugins/grpc/call.rb +1 -2
- data/lib/httpx/plugins/ntlm_authentication.rb +21 -19
- data/lib/httpx/plugins/proxy/socks4.rb +4 -0
- data/lib/httpx/plugins/proxy/socks5.rb +4 -0
- data/lib/httpx/pmatch_extensions.rb +33 -0
- data/lib/httpx/punycode.rb +304 -0
- data/lib/httpx/request.rb +1 -1
- data/lib/httpx/response.rb +2 -0
- data/lib/httpx/selector.rb +31 -31
- data/lib/httpx/utils.rb +6 -4
- data/lib/httpx/version.rb +1 -1
- data/sig/chainable.rbs +5 -0
- data/sig/connection/http1.rbs +2 -0
- data/sig/connection/http2.rbs +2 -0
- data/sig/options.rbs +1 -1
- data/sig/plugins/aws_sdk_authentication.rbs +2 -0
- data/sig/plugins/basic_authentication.rbs +1 -1
- data/sig/plugins/digest_authentication.rbs +1 -1
- data/sig/plugins/follow_redirects.rbs +1 -1
- data/sig/plugins/grpc.rbs +93 -0
- data/sig/plugins/multipart.rbs +1 -1
- data/sig/plugins/proxy/socks4.rbs +1 -0
- data/sig/plugins/proxy/socks5.rbs +1 -0
- data/sig/utils.rbs +7 -0
- metadata +46 -41
- data/lib/httpx/idna.rb +0 -15
data/lib/httpx/request.rb
CHANGED
@@ -45,7 +45,7 @@ module HTTPX
|
|
45
45
|
def initialize(verb, uri, options = {})
|
46
46
|
@verb = verb.to_s.downcase.to_sym
|
47
47
|
@options = Options.new(options)
|
48
|
-
@uri = Utils.
|
48
|
+
@uri = Utils.to_uri(uri)
|
49
49
|
if @uri.relative?
|
50
50
|
raise(Error, "invalid URI: #{@uri}") unless @options.origin
|
51
51
|
|
data/lib/httpx/response.rb
CHANGED
data/lib/httpx/selector.rb
CHANGED
@@ -52,41 +52,41 @@ class HTTPX::Selector
|
|
52
52
|
# first, we group IOs based on interest type. On call to #interests however,
|
53
53
|
# things might already happen, and new IOs might be registered, so we might
|
54
54
|
# have to start all over again. We do this until we group all selectables
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
@selectables
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
55
|
+
begin
|
56
|
+
loop do
|
57
|
+
begin
|
58
|
+
r = nil
|
59
|
+
w = nil
|
60
|
+
|
61
|
+
selectables = @selectables
|
62
|
+
@selectables = []
|
63
|
+
|
64
|
+
selectables.each do |io|
|
65
|
+
interests = io.interests
|
66
|
+
|
67
|
+
(r ||= []) << io if READ_INTERESTS.include?(interests)
|
68
|
+
(w ||= []) << io if WRITE_INTERESTS.include?(interests)
|
69
|
+
end
|
70
|
+
|
71
|
+
if @selectables.empty?
|
72
|
+
@selectables = selectables
|
73
|
+
|
74
|
+
# do not run event loop if there's nothing to wait on.
|
75
|
+
# this might happen if connect failed and connection was unregistered.
|
76
|
+
return if (!r || r.empty?) && (!w || w.empty?)
|
77
|
+
|
78
|
+
break
|
79
|
+
else
|
80
|
+
@selectables = [*selectables, @selectables]
|
81
|
+
end
|
82
|
+
rescue StandardError
|
83
|
+
@selectables = selectables if selectables
|
84
|
+
raise
|
80
85
|
end
|
81
|
-
rescue StandardError
|
82
|
-
@selectables = selectables if selectables
|
83
|
-
raise
|
84
86
|
end
|
85
|
-
end
|
86
87
|
|
87
|
-
|
88
|
+
# TODO: what to do if there are no selectables?
|
88
89
|
|
89
|
-
begin
|
90
90
|
readers, writers = IO.select(r, w, nil, interval)
|
91
91
|
|
92
92
|
raise HTTPX::TimeoutError.new(interval, "timed out while waiting on select") if readers.nil? && writers.nil?
|
data/lib/httpx/utils.rb
CHANGED
@@ -18,14 +18,16 @@ module HTTPX
|
|
18
18
|
end
|
19
19
|
|
20
20
|
if RUBY_VERSION < "2.3"
|
21
|
-
|
22
|
-
|
21
|
+
|
22
|
+
def to_uri(uri)
|
23
|
+
URI(uri)
|
23
24
|
end
|
25
|
+
|
24
26
|
else
|
25
27
|
|
26
28
|
URIParser = URI::RFC2396_Parser.new
|
27
29
|
|
28
|
-
def
|
30
|
+
def to_uri(uri)
|
29
31
|
return Kernel.URI(uri) unless uri.is_a?(String) && !uri.ascii_only?
|
30
32
|
|
31
33
|
uri = Kernel.URI(URIParser.escape(uri))
|
@@ -34,7 +36,7 @@ module HTTPX
|
|
34
36
|
|
35
37
|
non_ascii_hostname.force_encoding(Encoding::UTF_8)
|
36
38
|
|
37
|
-
idna_hostname =
|
39
|
+
idna_hostname = Punycode.encode_hostname(non_ascii_hostname)
|
38
40
|
|
39
41
|
uri.host = idna_hostname
|
40
42
|
uri.non_ascii_hostname = non_ascii_hostname
|
data/lib/httpx/version.rb
CHANGED
data/sig/chainable.rbs
CHANGED
@@ -14,6 +14,8 @@ module HTTPX
|
|
14
14
|
def plugin: (:authentication) -> Plugins::sessionAuthentication
|
15
15
|
| (:basic_authentication) -> Plugins::sessionBasicAuthentication
|
16
16
|
| (:digest_authentication) -> Plugins::sessionDigestAuthentication
|
17
|
+
| (:ntlm_authentication) -> Plugins::sessionNTLMAuthentication
|
18
|
+
| (:aws_sdk_authentication) -> Plugins::sessionAwsSdkAuthentication
|
17
19
|
| (:compression) -> Session
|
18
20
|
| (:cookies) -> Plugins::sessionCookies
|
19
21
|
| (:expect) -> Session
|
@@ -25,7 +27,10 @@ module HTTPX
|
|
25
27
|
| (:proxy) -> Plugins::sessionProxy
|
26
28
|
| (:push_promise) -> Plugins::sessionPushPromise
|
27
29
|
| (:retries) -> Plugins::sessionRetries
|
30
|
+
| (:rate_limiter) -> Session
|
28
31
|
| (:stream) -> Plugins::sessionStream
|
32
|
+
| (:aws_sigv4) -> Plugins::awsSigV4Session
|
33
|
+
| (:grpc) -> Plugins::grpcSession
|
29
34
|
| (Symbol | Module, ?options?) { (Class) -> void } -> Session
|
30
35
|
| (Symbol | Module, ?options?) -> Session
|
31
36
|
|
data/sig/connection/http1.rbs
CHANGED
data/sig/connection/http2.rbs
CHANGED
data/sig/options.rbs
CHANGED
@@ -5,7 +5,7 @@ module HTTPX
|
|
5
5
|
WINDOW_SIZE: Integer
|
6
6
|
MAX_BODY_THRESHOLD_SIZE: Integer
|
7
7
|
|
8
|
-
type timeout_type = :connect_timeout
|
8
|
+
type timeout_type = :connect_timeout | :settings_timeout | :operation_timeout | :keep_alive_timeout | :total_timeout
|
9
9
|
type timeout = Hash[timeout_type, Numeric?]
|
10
10
|
|
11
11
|
def self.new: (options) -> instance
|
@@ -10,6 +10,6 @@ module HTTPX
|
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
|
-
type sessionBasicAuthentication = Plugins::sessionAuthentication & Plugins::
|
13
|
+
type sessionBasicAuthentication = Plugins::sessionAuthentication & Plugins::BasicAuthentication::InstanceMethods
|
14
14
|
end
|
15
15
|
end
|
@@ -27,6 +27,6 @@ module HTTPX
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
-
type sessionDigestAuthentication = Plugins::sessionAuthentication & Plugins::
|
30
|
+
type sessionDigestAuthentication = Plugins::sessionAuthentication & Plugins::DigestAuthentication::InstanceMethods
|
31
31
|
end
|
32
32
|
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
module HTTPX
|
2
|
+
class GRPCError < Error
|
3
|
+
attr_reader status: Integer
|
4
|
+
attr_reader details: String
|
5
|
+
attr_reader metadata: headers
|
6
|
+
end
|
7
|
+
|
8
|
+
module Plugins
|
9
|
+
module GRPC
|
10
|
+
type compression_option = bool | String
|
11
|
+
type rpc_def = [String, untyped, untyped, Hash[Symbol, untyped]]
|
12
|
+
|
13
|
+
type grpc_message = String | _Each[String]
|
14
|
+
|
15
|
+
type grpc_request = untyped | _Each[untyped]
|
16
|
+
type grpc_response = untyped | _Each[untyped]
|
17
|
+
|
18
|
+
class Call
|
19
|
+
attr_writer decoder: _Callable
|
20
|
+
|
21
|
+
def metadata: () -> headers
|
22
|
+
|
23
|
+
def trailing_metadata: () -> headers?
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def initialize: (Response | StreamResponse response) -> untyped
|
28
|
+
|
29
|
+
def grpc_response: () -> grpc_response
|
30
|
+
end
|
31
|
+
|
32
|
+
module Message
|
33
|
+
def self?.unary: (response) -> grpc_message
|
34
|
+
|
35
|
+
def self?.stream: (StreamResponse) { (String) -> void } -> void
|
36
|
+
| (StreamResponse) -> Enumerable[String]
|
37
|
+
|
38
|
+
def self?.encode: (String bytes, ?deflater: Compression::_Deflater?) -> String
|
39
|
+
|
40
|
+
def self?.decode: (String message, encodings: Array[String], encoders: Compression::encodings_registry) -> String
|
41
|
+
| (String message, encodings: Array[String], encoders: Compression::encodings_registry) { (String) -> void } -> void
|
42
|
+
|
43
|
+
def self?.cancel: (Request) -> void
|
44
|
+
|
45
|
+
def self?.verify_status: (StreamResponse | response) -> void
|
46
|
+
end
|
47
|
+
|
48
|
+
interface _GRPCOptions
|
49
|
+
def grpc_service: () -> String?
|
50
|
+
def grpc_service=: (string) -> String
|
51
|
+
|
52
|
+
def grpc_compression: () -> compression_option?
|
53
|
+
def grpc_compression=: (compression_option) -> compression_option
|
54
|
+
|
55
|
+
def grpc_rpcs: () -> Hash[String, rpc_def]?
|
56
|
+
def grpc_rpcs=: (Hash[String, rpc_def]) -> Hash[String, rpc_def]
|
57
|
+
|
58
|
+
def grpc_deadline: () -> Integer?
|
59
|
+
def grpc_deadline=: (Integer) -> Integer
|
60
|
+
|
61
|
+
def call_credentials: () -> credentials?
|
62
|
+
def call_credentials=: (credentials) -> credentials
|
63
|
+
end
|
64
|
+
|
65
|
+
def self.extra_options: (Options) -> (Options & _GRPCOptions)
|
66
|
+
def self.load_dependencies: (singleton(Session)) -> void
|
67
|
+
|
68
|
+
module ResponseMethods
|
69
|
+
def merge_headers: (headers_input trailers) -> void
|
70
|
+
|
71
|
+
def encoders: () -> Compression::encodings_registry
|
72
|
+
end
|
73
|
+
|
74
|
+
module InstanceMethods
|
75
|
+
def with_channel_credentials: (String ca_path, ?String? key, ?String? cert, **untyped) -> instance
|
76
|
+
|
77
|
+
def rpc: (_ToS rpc_name, untyped input, untyped output, **untyped) -> instance
|
78
|
+
|
79
|
+
def build_stub: (string origin, ?service: _ToS, ?compression: compression_option) -> instance
|
80
|
+
|
81
|
+
def execute: (_ToS rpc_method, grpc_message input, ?deadline: Integer, ?metadata: headers_input, **untyped) -> Call
|
82
|
+
|
83
|
+
private
|
84
|
+
|
85
|
+
def rpc_execute: (_ToS rpc_method, grpc_request input, **untyped) -> Call
|
86
|
+
|
87
|
+
def build_grpc_request: (string rpc_method, grpc_message input, ?deadline: Integer, ?metadata?: headers_input, **untyped) -> Request
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
type grpcSession = Session & Plugins::GRPC::InstanceMethods
|
92
|
+
end
|
93
|
+
end
|
data/sig/plugins/multipart.rbs
CHANGED
@@ -23,7 +23,7 @@ module HTTPX
|
|
23
23
|
|
24
24
|
private
|
25
25
|
|
26
|
-
def initialize: (
|
26
|
+
def initialize: (_Each[Symbol | string, multipart_nested_value] multipart_data) -> untyped
|
27
27
|
|
28
28
|
def header_part: (string key, String content_type, String? filename) -> StringIO
|
29
29
|
|
data/sig/utils.rbs
ADDED
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.
|
4
|
+
version: 0.15.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tiago Cardoso
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-06-
|
11
|
+
date: 2021-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http-2-next
|
@@ -47,49 +47,50 @@ extra_rdoc_files:
|
|
47
47
|
- LICENSE.txt
|
48
48
|
- README.md
|
49
49
|
- doc/release_notes/0_0_1.md
|
50
|
-
- doc/release_notes/
|
51
|
-
- doc/release_notes/
|
52
|
-
- doc/release_notes/0_0_5.md
|
53
|
-
- doc/release_notes/0_14_1.md
|
50
|
+
- doc/release_notes/0_0_2.md
|
51
|
+
- doc/release_notes/0_0_3.md
|
54
52
|
- doc/release_notes/0_0_4.md
|
55
|
-
- doc/release_notes/
|
56
|
-
- doc/release_notes/
|
57
|
-
- doc/release_notes/
|
58
|
-
- doc/release_notes/0_13_0.md
|
59
|
-
- doc/release_notes/0_6_1.md
|
60
|
-
- doc/release_notes/0_11_2.md
|
61
|
-
- doc/release_notes/0_7_0.md
|
62
|
-
- doc/release_notes/0_6_0.md
|
53
|
+
- doc/release_notes/0_0_5.md
|
54
|
+
- doc/release_notes/0_10_0.md
|
55
|
+
- doc/release_notes/0_10_1.md
|
63
56
|
- doc/release_notes/0_10_2.md
|
57
|
+
- doc/release_notes/0_11_0.md
|
58
|
+
- doc/release_notes/0_11_1.md
|
59
|
+
- doc/release_notes/0_11_2.md
|
64
60
|
- doc/release_notes/0_11_3.md
|
65
|
-
- doc/release_notes/0_8_2.md
|
66
|
-
- doc/release_notes/0_6_4.md
|
67
|
-
- doc/release_notes/0_13_1.md
|
68
61
|
- doc/release_notes/0_12_0.md
|
69
|
-
- doc/release_notes/
|
70
|
-
- doc/release_notes/
|
71
|
-
- doc/release_notes/0_10_1.md
|
72
|
-
- doc/release_notes/0_11_0.md
|
73
|
-
- doc/release_notes/0_8_1.md
|
74
|
-
- doc/release_notes/0_5_0.md
|
75
|
-
- doc/release_notes/0_6_7.md
|
62
|
+
- doc/release_notes/0_13_0.md
|
63
|
+
- doc/release_notes/0_13_1.md
|
76
64
|
- doc/release_notes/0_13_2.md
|
65
|
+
- doc/release_notes/0_14_0.md
|
66
|
+
- doc/release_notes/0_14_1.md
|
67
|
+
- doc/release_notes/0_14_2.md
|
68
|
+
- doc/release_notes/0_14_3.md
|
69
|
+
- doc/release_notes/0_14_4.md
|
70
|
+
- doc/release_notes/0_14_5.md
|
71
|
+
- doc/release_notes/0_15_0.md
|
72
|
+
- doc/release_notes/0_1_0.md
|
73
|
+
- doc/release_notes/0_2_0.md
|
74
|
+
- doc/release_notes/0_2_1.md
|
75
|
+
- doc/release_notes/0_3_0.md
|
76
|
+
- doc/release_notes/0_3_1.md
|
77
|
+
- doc/release_notes/0_4_0.md
|
77
78
|
- doc/release_notes/0_4_1.md
|
79
|
+
- doc/release_notes/0_5_0.md
|
78
80
|
- doc/release_notes/0_5_1.md
|
79
|
-
- doc/release_notes/
|
80
|
-
- doc/release_notes/
|
81
|
+
- doc/release_notes/0_6_0.md
|
82
|
+
- doc/release_notes/0_6_1.md
|
81
83
|
- doc/release_notes/0_6_2.md
|
82
|
-
- doc/release_notes/
|
83
|
-
- doc/release_notes/
|
84
|
+
- doc/release_notes/0_6_3.md
|
85
|
+
- doc/release_notes/0_6_4.md
|
86
|
+
- doc/release_notes/0_6_5.md
|
87
|
+
- doc/release_notes/0_6_6.md
|
88
|
+
- doc/release_notes/0_6_7.md
|
89
|
+
- doc/release_notes/0_7_0.md
|
84
90
|
- doc/release_notes/0_8_0.md
|
85
|
-
- doc/release_notes/
|
86
|
-
- doc/release_notes/
|
87
|
-
- doc/release_notes/
|
88
|
-
- doc/release_notes/0_0_3.md
|
89
|
-
- doc/release_notes/0_0_2.md
|
90
|
-
- doc/release_notes/0_3_1.md
|
91
|
-
- doc/release_notes/0_14_2.md
|
92
|
-
- doc/release_notes/0_2_0.md
|
91
|
+
- doc/release_notes/0_8_1.md
|
92
|
+
- doc/release_notes/0_8_2.md
|
93
|
+
- doc/release_notes/0_9_0.md
|
93
94
|
files:
|
94
95
|
- LICENSE.txt
|
95
96
|
- README.md
|
@@ -115,6 +116,7 @@ files:
|
|
115
116
|
- doc/release_notes/0_14_3.md
|
116
117
|
- doc/release_notes/0_14_4.md
|
117
118
|
- doc/release_notes/0_14_5.md
|
119
|
+
- doc/release_notes/0_15_0.md
|
118
120
|
- doc/release_notes/0_1_0.md
|
119
121
|
- doc/release_notes/0_2_0.md
|
120
122
|
- doc/release_notes/0_2_1.md
|
@@ -152,7 +154,6 @@ files:
|
|
152
154
|
- lib/httpx/errors.rb
|
153
155
|
- lib/httpx/extensions.rb
|
154
156
|
- lib/httpx/headers.rb
|
155
|
-
- lib/httpx/idna.rb
|
156
157
|
- lib/httpx/io.rb
|
157
158
|
- lib/httpx/io/ssl.rb
|
158
159
|
- lib/httpx/io/tcp.rb
|
@@ -202,7 +203,9 @@ files:
|
|
202
203
|
- lib/httpx/plugins/stream.rb
|
203
204
|
- lib/httpx/plugins/upgrade.rb
|
204
205
|
- lib/httpx/plugins/upgrade/h2.rb
|
206
|
+
- lib/httpx/pmatch_extensions.rb
|
205
207
|
- lib/httpx/pool.rb
|
208
|
+
- lib/httpx/punycode.rb
|
206
209
|
- lib/httpx/registry.rb
|
207
210
|
- lib/httpx/request.rb
|
208
211
|
- lib/httpx/resolver.rb
|
@@ -247,6 +250,7 @@ files:
|
|
247
250
|
- sig/plugins/digest_authentication.rbs
|
248
251
|
- sig/plugins/expect.rbs
|
249
252
|
- sig/plugins/follow_redirects.rbs
|
253
|
+
- sig/plugins/grpc.rbs
|
250
254
|
- sig/plugins/h2c.rbs
|
251
255
|
- sig/plugins/multipart.rbs
|
252
256
|
- sig/plugins/ntlm_authentication.rbs
|
@@ -277,6 +281,7 @@ files:
|
|
277
281
|
- sig/transcoder/chunker.rbs
|
278
282
|
- sig/transcoder/form.rbs
|
279
283
|
- sig/transcoder/json.rbs
|
284
|
+
- sig/utils.rbs
|
280
285
|
homepage: https://gitlab.com/honeyryderchuck/httpx
|
281
286
|
licenses:
|
282
287
|
- Apache 2.0
|
@@ -285,7 +290,7 @@ metadata:
|
|
285
290
|
changelog_uri: https://honeyryderchuck.gitlab.io/httpx/#release-notes
|
286
291
|
documentation_uri: https://honeyryderchuck.gitlab.io/httpx/rdoc/
|
287
292
|
source_code_uri: https://gitlab.com/honeyryderchuck/httpx
|
288
|
-
post_install_message:
|
293
|
+
post_install_message:
|
289
294
|
rdoc_options: []
|
290
295
|
require_paths:
|
291
296
|
- lib
|
@@ -300,8 +305,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
300
305
|
- !ruby/object:Gem::Version
|
301
306
|
version: '0'
|
302
307
|
requirements: []
|
303
|
-
rubygems_version: 3.
|
304
|
-
signing_key:
|
308
|
+
rubygems_version: 3.2.15
|
309
|
+
signing_key:
|
305
310
|
specification_version: 4
|
306
311
|
summary: HTTPX, to the future, and beyond
|
307
312
|
test_files: []
|