httpx 0.14.4 → 0.15.3
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_14_5.md +11 -0
- data/doc/release_notes/0_15_0.md +53 -0
- data/doc/release_notes/0_15_1.md +8 -0
- data/doc/release_notes/0_15_2.md +9 -0
- data/doc/release_notes/0_15_3.md +5 -0
- data/lib/httpx.rb +1 -0
- data/lib/httpx/connection.rb +14 -3
- data/lib/httpx/connection/http1.rb +22 -5
- 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/loggable.rb +1 -1
- data/lib/httpx/options.rb +5 -1
- data/lib/httpx/plugins/cookies/cookie.rb +1 -2
- data/lib/httpx/plugins/cookies/jar.rb +4 -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 +66 -0
- 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 +41 -37
- 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/ntlm_authentication.rbs +27 -0
- data/sig/plugins/proxy/socks4.rbs +1 -0
- data/sig/plugins/proxy/socks5.rbs +1 -0
- data/sig/selector.rbs +1 -0
- data/sig/utils.rbs +7 -0
- metadata +19 -3
- 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.concat(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?
|
@@ -95,14 +95,18 @@ class HTTPX::Selector
|
|
95
95
|
retry
|
96
96
|
end
|
97
97
|
|
98
|
-
|
99
|
-
|
98
|
+
if writers
|
99
|
+
readers.each do |io|
|
100
|
+
yield io
|
100
101
|
|
101
|
-
|
102
|
-
|
103
|
-
|
102
|
+
# so that we don't yield 2 times
|
103
|
+
writers.delete(io)
|
104
|
+
end if readers
|
104
105
|
|
105
|
-
|
106
|
+
writers.each(&block)
|
107
|
+
else
|
108
|
+
readers.each(&block) if readers
|
109
|
+
end
|
106
110
|
end
|
107
111
|
|
108
112
|
def select_one(interval)
|
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
|
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module HTTPX
|
2
|
+
module Plugins
|
3
|
+
module NTLMAuthentication
|
4
|
+
|
5
|
+
interface _NTLMOptions
|
6
|
+
def ntlm: () -> NTLMParams?
|
7
|
+
def ntlm=: (NTLMParams) -> NTLMParams
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.extra_options: (Options) -> (Options & _NTLMOptions)
|
11
|
+
|
12
|
+
def self.load_dependencies: (*untyped) -> void
|
13
|
+
|
14
|
+
module InstanceMethods
|
15
|
+
def ntlm_authentication: (string user, string password, ?string? domain) -> instance
|
16
|
+
end
|
17
|
+
|
18
|
+
class NTLMParams
|
19
|
+
attr_reader user: String
|
20
|
+
attr_reader password: String
|
21
|
+
attr_reader domain: String?
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
type sessionNTLMAuthentication = Plugins::sessionAuthentication & Plugins::NTLMAuthentication::InstanceMethods
|
26
|
+
end
|
27
|
+
end
|
data/sig/selector.rbs
CHANGED
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.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tiago Cardoso
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http-2-next
|
@@ -67,6 +67,11 @@ extra_rdoc_files:
|
|
67
67
|
- doc/release_notes/0_14_2.md
|
68
68
|
- doc/release_notes/0_14_3.md
|
69
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_15_1.md
|
73
|
+
- doc/release_notes/0_15_2.md
|
74
|
+
- doc/release_notes/0_15_3.md
|
70
75
|
- doc/release_notes/0_1_0.md
|
71
76
|
- doc/release_notes/0_2_0.md
|
72
77
|
- doc/release_notes/0_2_1.md
|
@@ -113,6 +118,11 @@ files:
|
|
113
118
|
- doc/release_notes/0_14_2.md
|
114
119
|
- doc/release_notes/0_14_3.md
|
115
120
|
- doc/release_notes/0_14_4.md
|
121
|
+
- doc/release_notes/0_14_5.md
|
122
|
+
- doc/release_notes/0_15_0.md
|
123
|
+
- doc/release_notes/0_15_1.md
|
124
|
+
- doc/release_notes/0_15_2.md
|
125
|
+
- doc/release_notes/0_15_3.md
|
116
126
|
- doc/release_notes/0_1_0.md
|
117
127
|
- doc/release_notes/0_2_0.md
|
118
128
|
- doc/release_notes/0_2_1.md
|
@@ -150,7 +160,6 @@ files:
|
|
150
160
|
- lib/httpx/errors.rb
|
151
161
|
- lib/httpx/extensions.rb
|
152
162
|
- lib/httpx/headers.rb
|
153
|
-
- lib/httpx/idna.rb
|
154
163
|
- lib/httpx/io.rb
|
155
164
|
- lib/httpx/io/ssl.rb
|
156
165
|
- lib/httpx/io/tcp.rb
|
@@ -187,6 +196,7 @@ files:
|
|
187
196
|
- lib/httpx/plugins/multipart/encoder.rb
|
188
197
|
- lib/httpx/plugins/multipart/mime_type_detector.rb
|
189
198
|
- lib/httpx/plugins/multipart/part.rb
|
199
|
+
- lib/httpx/plugins/ntlm_authentication.rb
|
190
200
|
- lib/httpx/plugins/persistent.rb
|
191
201
|
- lib/httpx/plugins/proxy.rb
|
192
202
|
- lib/httpx/plugins/proxy/http.rb
|
@@ -199,7 +209,9 @@ files:
|
|
199
209
|
- lib/httpx/plugins/stream.rb
|
200
210
|
- lib/httpx/plugins/upgrade.rb
|
201
211
|
- lib/httpx/plugins/upgrade/h2.rb
|
212
|
+
- lib/httpx/pmatch_extensions.rb
|
202
213
|
- lib/httpx/pool.rb
|
214
|
+
- lib/httpx/punycode.rb
|
203
215
|
- lib/httpx/registry.rb
|
204
216
|
- lib/httpx/request.rb
|
205
217
|
- lib/httpx/resolver.rb
|
@@ -244,8 +256,10 @@ files:
|
|
244
256
|
- sig/plugins/digest_authentication.rbs
|
245
257
|
- sig/plugins/expect.rbs
|
246
258
|
- sig/plugins/follow_redirects.rbs
|
259
|
+
- sig/plugins/grpc.rbs
|
247
260
|
- sig/plugins/h2c.rbs
|
248
261
|
- sig/plugins/multipart.rbs
|
262
|
+
- sig/plugins/ntlm_authentication.rbs
|
249
263
|
- sig/plugins/persistent.rbs
|
250
264
|
- sig/plugins/proxy.rbs
|
251
265
|
- sig/plugins/proxy/http.rbs
|
@@ -273,6 +287,7 @@ files:
|
|
273
287
|
- sig/transcoder/chunker.rbs
|
274
288
|
- sig/transcoder/form.rbs
|
275
289
|
- sig/transcoder/json.rbs
|
290
|
+
- sig/utils.rbs
|
276
291
|
homepage: https://gitlab.com/honeyryderchuck/httpx
|
277
292
|
licenses:
|
278
293
|
- Apache 2.0
|
@@ -281,6 +296,7 @@ metadata:
|
|
281
296
|
changelog_uri: https://honeyryderchuck.gitlab.io/httpx/#release-notes
|
282
297
|
documentation_uri: https://honeyryderchuck.gitlab.io/httpx/rdoc/
|
283
298
|
source_code_uri: https://gitlab.com/honeyryderchuck/httpx
|
299
|
+
homepage_uri: https://honeyryderchuck.gitlab.io/httpx/
|
284
300
|
post_install_message:
|
285
301
|
rdoc_options: []
|
286
302
|
require_paths:
|