httpx 0.10.0 → 0.10.1
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/0_10_1.md +39 -0
- data/lib/httpx/chainable.rb +7 -6
- data/lib/httpx/connection.rb +4 -15
- data/lib/httpx/connection/http1.rb +14 -1
- data/lib/httpx/connection/http2.rb +11 -12
- data/lib/httpx/errors.rb +1 -1
- data/lib/httpx/plugins/multipart.rb +15 -1
- data/lib/httpx/plugins/proxy.rb +16 -2
- data/lib/httpx/plugins/proxy/socks4.rb +14 -16
- data/lib/httpx/pool.rb +8 -14
- data/lib/httpx/request.rb +1 -1
- data/lib/httpx/resolver.rb +0 -2
- data/lib/httpx/resolver/https.rb +15 -22
- data/lib/httpx/resolver/native.rb +12 -13
- data/lib/httpx/resolver/resolver_mixin.rb +4 -2
- data/lib/httpx/resolver/system.rb +2 -2
- data/lib/httpx/selector.rb +8 -13
- data/lib/httpx/session.rb +9 -3
- data/lib/httpx/transcoder.rb +18 -0
- data/lib/httpx/transcoder/form.rb +9 -1
- data/lib/httpx/version.rb +1 -1
- data/sig/connection.rbs +84 -1
- data/sig/connection/http1.rbs +66 -0
- data/sig/connection/http2.rbs +74 -0
- data/sig/httpx.rbs +1 -0
- data/sig/options.rbs +3 -3
- data/sig/plugins/basic_authentication.rbs +1 -1
- data/sig/plugins/compression.rbs +1 -1
- data/sig/plugins/compression/brotli.rbs +1 -1
- data/sig/plugins/compression/deflate.rbs +1 -1
- data/sig/plugins/compression/gzip.rbs +1 -1
- data/sig/plugins/h2c.rbs +1 -1
- data/sig/plugins/multipart.rbs +4 -2
- data/sig/plugins/persistent.rbs +1 -1
- data/sig/plugins/proxy.rbs +2 -2
- data/sig/plugins/proxy/ssh.rbs +1 -1
- data/sig/plugins/rate_limiter.rbs +1 -1
- data/sig/pool.rbs +36 -2
- data/sig/request.rbs +1 -1
- data/sig/resolver.rbs +26 -0
- data/sig/resolver/https.rbs +49 -0
- data/sig/resolver/native.rbs +60 -0
- data/sig/resolver/resolver_mixin.rbs +27 -0
- data/sig/resolver/system.rbs +17 -0
- data/sig/response.rbs +1 -1
- data/sig/selector.rbs +20 -0
- data/sig/session.rbs +2 -2
- data/sig/transcoder.rbs +4 -2
- data/sig/transcoder/form.rbs +1 -1
- metadata +11 -4
- data/lib/httpx/resolver/options.rb +0 -25
- data/sig/test.rbs +0 -9
data/sig/httpx.rbs
CHANGED
@@ -4,6 +4,7 @@ module HTTPX
|
|
4
4
|
VERSION: String
|
5
5
|
|
6
6
|
type uri = URI::HTTP | URI::HTTPS | string
|
7
|
+
type generic_uri = uri | URI::Generic
|
7
8
|
|
8
9
|
type verb = :options | :get | :head | :post | :put | :delete | :trace | :connect |
|
9
10
|
:propfind | :proppatch | :mkcol | :copy | :move | :lock | :unlock | :orderpatch |
|
data/sig/options.rbs
CHANGED
@@ -77,9 +77,9 @@ module HTTPX
|
|
77
77
|
# resolver_class resolver_options
|
78
78
|
|
79
79
|
# request_class
|
80
|
-
|
81
|
-
|
82
|
-
|
80
|
+
attr_reader request_class: singleton(Request)
|
81
|
+
def request_class=: (singleton(Request)) -> void
|
82
|
+
def with_request_class: (singleton(Request)) -> instance
|
83
83
|
|
84
84
|
# io
|
85
85
|
attr_reader io: _ToIO?
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module HTTPX
|
2
2
|
module Plugins
|
3
3
|
module BasicAuthentication
|
4
|
-
|
4
|
+
def self.load_dependencies: (singleton(Session)) -> void
|
5
5
|
|
6
6
|
module InstanceMethods
|
7
7
|
def basic_authentication: (string user, string password) -> instance
|
data/sig/plugins/compression.rbs
CHANGED
@@ -16,7 +16,7 @@ module HTTPX
|
|
16
16
|
def initialize: (Numeric bytesize) -> untyped
|
17
17
|
end
|
18
18
|
|
19
|
-
|
19
|
+
def self.load_dependencies: (singleton(Session)) -> void
|
20
20
|
|
21
21
|
interface _CompressionOptions
|
22
22
|
def compression_threshold_size: () -> _Integer?
|
@@ -2,7 +2,7 @@ module HTTPX
|
|
2
2
|
module Plugins
|
3
3
|
module Compression
|
4
4
|
module Deflate
|
5
|
-
|
5
|
+
def self.load_dependencies: (singleton(Session)) -> void
|
6
6
|
def self.configure: (*untyped) -> void
|
7
7
|
|
8
8
|
def self?.deflater: () -> _Deflater
|
data/sig/plugins/h2c.rbs
CHANGED
data/sig/plugins/multipart.rbs
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module HTTPX
|
2
2
|
module Plugins
|
3
3
|
module Multipart
|
4
|
-
|
4
|
+
def self.load_dependencies: (singleton(Session)) -> void
|
5
5
|
def self.configure: (*untyped) -> void
|
6
6
|
def self?.encode: (untyped) -> Encoder
|
7
7
|
|
@@ -12,7 +12,9 @@ module HTTPX
|
|
12
12
|
|
13
13
|
private
|
14
14
|
|
15
|
-
def
|
15
|
+
def initialize: (Hash[Symbol | string, HTTP::FormData::Part | string] multipart_data) -> untyped
|
16
|
+
|
17
|
+
def multipart?: (top) -> bool
|
16
18
|
end
|
17
19
|
end
|
18
20
|
end
|
data/sig/plugins/persistent.rbs
CHANGED
data/sig/plugins/proxy.rbs
CHANGED
@@ -18,10 +18,10 @@ module HTTPX
|
|
18
18
|
|
19
19
|
private
|
20
20
|
|
21
|
-
def initialize: (uri:
|
21
|
+
def initialize: (uri: generic_uri, ?username: string, ?password: string) -> untyped
|
22
22
|
end
|
23
23
|
|
24
|
-
|
24
|
+
def self.configure: (singleton(Session)) -> void
|
25
25
|
|
26
26
|
type proxyParam = Parameters | Hash
|
27
27
|
|
data/sig/plugins/proxy/ssh.rbs
CHANGED
data/sig/pool.rbs
CHANGED
@@ -1,2 +1,36 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
module HTTPX
|
2
|
+
class Pool
|
3
|
+
def empty?: () -> void
|
4
|
+
|
5
|
+
def next_tick: () -> void
|
6
|
+
|
7
|
+
def close: (Array[Connection]) -> void
|
8
|
+
| () -> void
|
9
|
+
|
10
|
+
def init_connection: (Connection, Options) -> void
|
11
|
+
|
12
|
+
def find_connection: (generic_uri, Options) -> Connection?
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def initialize: () -> untyped
|
17
|
+
|
18
|
+
def resolve_connection: (Connection) -> void
|
19
|
+
|
20
|
+
def on_resolver_connection: (Connection) -> void
|
21
|
+
|
22
|
+
def on_resolver_error: (Connection, StandardError) -> void
|
23
|
+
|
24
|
+
def on_resolver_close: (resolver) -> void
|
25
|
+
|
26
|
+
def register_connection: (Connection) -> void
|
27
|
+
|
28
|
+
def unregister_connection: (Connection) -> void
|
29
|
+
|
30
|
+
def coalesce_connections: (Connection, Connection) -> void
|
31
|
+
|
32
|
+
def next_timeout: () -> Numeric?
|
33
|
+
|
34
|
+
def find_resolver_for: (Connection) -> resolver
|
35
|
+
end
|
36
|
+
end
|
data/sig/request.rbs
CHANGED
data/sig/resolver.rbs
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
module HTTPX
|
2
|
+
type ipaddr = IPAddr | String
|
3
|
+
|
4
|
+
type resolver = Resolver::System | Resolver::Native | Resolver::HTTPS
|
5
|
+
|
6
|
+
module Resolver
|
7
|
+
type dns_resource = singleton(Resolv::DNS::Resource)
|
8
|
+
|
9
|
+
type dns_result = { "name" => String, "TTL" => Numeric, "alias" => String }
|
10
|
+
| { "name" => String, "TTL" => Numeric, "data" => String }
|
11
|
+
|
12
|
+
def self?.cached_lookup: (String hostname) -> Array[String]?
|
13
|
+
|
14
|
+
def self?.cached_lookup_set: (String hostname, Array[dns_result] addresses) -> void
|
15
|
+
|
16
|
+
def self?.uncache: (String hostname) -> void
|
17
|
+
|
18
|
+
def self?.lookup: (String hostname, Numeric ttl) -> Array[String]?
|
19
|
+
|
20
|
+
def self?.generate_id: () -> Integer
|
21
|
+
|
22
|
+
def self?.encode_dns_query: (String hostname, ?type: dns_resource) -> String
|
23
|
+
|
24
|
+
def self?.decode_dns_answer: (String) -> Array[dns_result]
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module HTTPX
|
2
|
+
module Resolver
|
3
|
+
class HTTPS
|
4
|
+
include ResolverMixin
|
5
|
+
include _ToIO
|
6
|
+
|
7
|
+
@options: Options
|
8
|
+
@resolver_options: Hash[Symbol, untyped]
|
9
|
+
@_record_types: Hash[String, Hash["A" | "AAAA", dns_resource]]
|
10
|
+
@queries: Hash[String, Connection]
|
11
|
+
@requests: Hash[Request, Connection]
|
12
|
+
@connections: Array[Connection]
|
13
|
+
@uri: URI::HTTPS
|
14
|
+
@uri_addresses: Array[String]?
|
15
|
+
|
16
|
+
def <<: (Connection) -> void
|
17
|
+
|
18
|
+
def timeout: () -> Numeric?
|
19
|
+
|
20
|
+
def closed?: () -> bool
|
21
|
+
|
22
|
+
def empty?: () -> bool
|
23
|
+
|
24
|
+
def close: () -> void
|
25
|
+
|
26
|
+
def call: () -> void
|
27
|
+
|
28
|
+
def interests: () -> io_interests?
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def initialize: (options) -> untyped
|
33
|
+
|
34
|
+
def pool: () -> Pool
|
35
|
+
|
36
|
+
def resolver_connection: () -> Connection
|
37
|
+
|
38
|
+
def resolve: (Connection, String hostname) -> void
|
39
|
+
| (Connection) -> void
|
40
|
+
| () -> void
|
41
|
+
|
42
|
+
def response: (Response) -> void
|
43
|
+
|
44
|
+
def build_request: (String hostname, "A" | "AAAA") -> Request
|
45
|
+
|
46
|
+
def decode_response_body: (Response) -> Array[dns_result]
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
module HTTPX
|
2
|
+
module Resolver
|
3
|
+
class Native
|
4
|
+
include ResolverMixin
|
5
|
+
include _ToIO
|
6
|
+
|
7
|
+
@options: Options
|
8
|
+
@ns_index: Integer
|
9
|
+
@resolver_options: Hash[Symbol, untyped]
|
10
|
+
@nameserver: String
|
11
|
+
@_timeouts: Array[Numeric]
|
12
|
+
@timeouts: Hash[String, Array[Numeric]]
|
13
|
+
@_record_types: Hash[String, Hash["A" | "AAAA", dns_resource]]
|
14
|
+
@connections: Array[Connection]
|
15
|
+
@queries: Hash[String, Connection]
|
16
|
+
@read_buffer: String
|
17
|
+
@write_buffer: Buffer
|
18
|
+
@state: :idle | :closed
|
19
|
+
|
20
|
+
def closed?: () -> bool
|
21
|
+
|
22
|
+
def empty?: () -> bool
|
23
|
+
|
24
|
+
def close: () -> void
|
25
|
+
|
26
|
+
def call: () -> void
|
27
|
+
|
28
|
+
def interests: () -> io_interests
|
29
|
+
|
30
|
+
def <<: (Connection) -> void
|
31
|
+
|
32
|
+
def timeout: () -> Numeric?
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def initialize: (options) -> untyped
|
37
|
+
|
38
|
+
def consume: () -> void
|
39
|
+
|
40
|
+
def do_retry: () -> void
|
41
|
+
|
42
|
+
def dread: (Integer) -> void
|
43
|
+
| () -> void
|
44
|
+
|
45
|
+
def dwrite: () -> void
|
46
|
+
|
47
|
+
def parse: (String) -> void
|
48
|
+
|
49
|
+
def resolve: (Connection, String hostname) -> void
|
50
|
+
| (Connection) -> void
|
51
|
+
| () -> void
|
52
|
+
|
53
|
+
def build_socket: () -> void
|
54
|
+
|
55
|
+
def transition: (Symbol nextstate) -> void
|
56
|
+
|
57
|
+
def handle_error: (StandardError) -> void
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module HTTPX
|
2
|
+
module Resolver
|
3
|
+
module ResolverMixin
|
4
|
+
include Callbacks
|
5
|
+
include Loggable
|
6
|
+
|
7
|
+
def uncache: (Connection) -> void
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
def emit_addresses: (Connection, Array[ipaddr]) -> void
|
12
|
+
|
13
|
+
def early_resolve: (Connection, ?hostname: String) -> void
|
14
|
+
|
15
|
+
def ip_resolve: (String hostname) -> Array[ipaddr]?
|
16
|
+
|
17
|
+
def system_resolve: (String hostname) -> Array[ipaddr]?
|
18
|
+
|
19
|
+
def emit_resolve_error: (Connection, String hostname, StandardError) -> void
|
20
|
+
| (Connection, String hostname) -> void
|
21
|
+
| (Connection) -> void
|
22
|
+
|
23
|
+
def resolve_error: (String hostname, StandardError?) -> void
|
24
|
+
| (String hostname) -> void
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/sig/response.rbs
CHANGED
data/sig/selector.rbs
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
module HTTPX
|
2
|
+
class Selector
|
3
|
+
READABLE: :r | :rw
|
4
|
+
WRITABLE: :w | :rw
|
5
|
+
|
6
|
+
def register: (_ToIO) -> void
|
7
|
+
def deregister: (_ToIO) -> void
|
8
|
+
|
9
|
+
def select: (Numeric?) { (_ToIO) -> void } -> void
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def initialize: () -> untyped
|
14
|
+
|
15
|
+
def select_many: (Numeric?) { (_ToIO) -> void } -> void
|
16
|
+
def select_one: (Numeric?) { (_ToIO) -> void } -> void
|
17
|
+
end
|
18
|
+
|
19
|
+
type io_interests = :r | :w | :rw
|
20
|
+
end
|
data/sig/session.rbs
CHANGED
@@ -16,8 +16,8 @@ module HTTPX
|
|
16
16
|
|
17
17
|
def build_request: (String | verb, uri, ?options) -> Request
|
18
18
|
|
19
|
-
|
20
|
-
|
19
|
+
def self.plugin: (Symbol | Module, ?options) { (Class) -> void } -> singleton(Session)
|
20
|
+
| (Symbol | Module, ?options) -> singleton(Session)
|
21
21
|
|
22
22
|
|
23
23
|
|
data/sig/transcoder.rbs
CHANGED
@@ -4,9 +4,11 @@ module HTTPX
|
|
4
4
|
module Transcoder
|
5
5
|
extend HTTPX::Registry[String, Class]
|
6
6
|
|
7
|
+
def self.normalize_keys: (string | Symbol, top) { (string, top) -> void } -> void
|
8
|
+
| (string | Symbol, top) { (string) -> void } -> void
|
9
|
+
|
7
10
|
interface _Encoder
|
8
|
-
def bytesize: () ->
|
9
|
-
def content_type: () -> String
|
11
|
+
def bytesize: () -> Numeric
|
10
12
|
end
|
11
13
|
|
12
14
|
interface _Decoder
|