httpx 0.15.4 → 0.18.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. checksums.yaml +4 -4
  2. data/doc/release_notes/0_16_0.md +93 -0
  3. data/doc/release_notes/0_16_1.md +5 -0
  4. data/doc/release_notes/0_17_0.md +49 -0
  5. data/doc/release_notes/0_18_0.md +69 -0
  6. data/lib/httpx/adapters/datadog.rb +1 -1
  7. data/lib/httpx/adapters/faraday.rb +8 -14
  8. data/lib/httpx/adapters/webmock.rb +9 -3
  9. data/lib/httpx/altsvc.rb +2 -2
  10. data/lib/httpx/buffer.rb +1 -1
  11. data/lib/httpx/callbacks.rb +1 -1
  12. data/lib/httpx/chainable.rb +18 -11
  13. data/lib/httpx/connection/http1.rb +21 -13
  14. data/lib/httpx/connection/http2.rb +20 -25
  15. data/lib/httpx/connection.rb +73 -77
  16. data/lib/httpx/domain_name.rb +1 -1
  17. data/lib/httpx/errors.rb +11 -11
  18. data/lib/httpx/extensions.rb +50 -4
  19. data/lib/httpx/headers.rb +1 -1
  20. data/lib/httpx/io/ssl.rb +3 -3
  21. data/lib/httpx/io/tls.rb +8 -8
  22. data/lib/httpx/loggable.rb +5 -5
  23. data/lib/httpx/options.rb +108 -81
  24. data/lib/httpx/parser/http1.rb +11 -7
  25. data/lib/httpx/plugins/aws_sdk_authentication.rb +42 -18
  26. data/lib/httpx/plugins/aws_sigv4.rb +19 -20
  27. data/lib/httpx/plugins/compression.rb +17 -14
  28. data/lib/httpx/plugins/cookies/cookie.rb +4 -2
  29. data/lib/httpx/plugins/cookies/jar.rb +21 -2
  30. data/lib/httpx/plugins/cookies.rb +20 -7
  31. data/lib/httpx/plugins/digest_authentication.rb +19 -15
  32. data/lib/httpx/plugins/expect.rb +26 -18
  33. data/lib/httpx/plugins/follow_redirects.rb +9 -9
  34. data/lib/httpx/plugins/grpc/call.rb +4 -1
  35. data/lib/httpx/plugins/grpc/message.rb +2 -2
  36. data/lib/httpx/plugins/grpc.rb +72 -46
  37. data/lib/httpx/plugins/h2c.rb +7 -3
  38. data/lib/httpx/plugins/internal_telemetry.rb +8 -8
  39. data/lib/httpx/plugins/multipart/decoder.rb +187 -0
  40. data/lib/httpx/plugins/multipart/mime_type_detector.rb +3 -3
  41. data/lib/httpx/plugins/multipart/part.rb +2 -2
  42. data/lib/httpx/plugins/multipart.rb +16 -2
  43. data/lib/httpx/plugins/ntlm_authentication.rb +12 -10
  44. data/lib/httpx/plugins/proxy/socks4.rb +2 -1
  45. data/lib/httpx/plugins/proxy/socks5.rb +2 -1
  46. data/lib/httpx/plugins/proxy/ssh.rb +20 -13
  47. data/lib/httpx/plugins/proxy.rb +10 -10
  48. data/lib/httpx/plugins/response_cache/store.rb +55 -0
  49. data/lib/httpx/plugins/response_cache.rb +88 -0
  50. data/lib/httpx/plugins/retries.rb +46 -23
  51. data/lib/httpx/plugins/stream.rb +3 -4
  52. data/lib/httpx/plugins/upgrade.rb +7 -6
  53. data/lib/httpx/pool.rb +39 -13
  54. data/lib/httpx/registry.rb +2 -2
  55. data/lib/httpx/request.rb +16 -25
  56. data/lib/httpx/resolver/https.rb +4 -8
  57. data/lib/httpx/resolver/native.rb +19 -5
  58. data/lib/httpx/resolver/resolver_mixin.rb +2 -1
  59. data/lib/httpx/resolver/system.rb +2 -0
  60. data/lib/httpx/resolver.rb +2 -2
  61. data/lib/httpx/response.rb +91 -48
  62. data/lib/httpx/selector.rb +11 -24
  63. data/lib/httpx/session.rb +41 -23
  64. data/lib/httpx/session2.rb +23 -0
  65. data/lib/httpx/timers.rb +84 -0
  66. data/lib/httpx/transcoder/body.rb +3 -2
  67. data/lib/httpx/transcoder/chunker.rb +2 -1
  68. data/lib/httpx/transcoder/form.rb +20 -0
  69. data/lib/httpx/transcoder/json.rb +12 -0
  70. data/lib/httpx/transcoder.rb +62 -1
  71. data/lib/httpx/utils.rb +10 -2
  72. data/lib/httpx/version.rb +1 -1
  73. data/lib/httpx.rb +7 -3
  74. data/sig/buffer.rbs +3 -1
  75. data/sig/chainable.rbs +31 -29
  76. data/sig/connection/http1.rbs +11 -5
  77. data/sig/connection/http2.rbs +16 -5
  78. data/sig/connection.rbs +31 -13
  79. data/sig/errors.rbs +35 -1
  80. data/sig/headers.rbs +20 -19
  81. data/sig/httpx.rbs +4 -1
  82. data/sig/loggable.rbs +3 -1
  83. data/sig/options.rbs +45 -34
  84. data/sig/parser/http1.rbs +3 -3
  85. data/sig/plugins/authentication.rbs +1 -1
  86. data/sig/plugins/aws_sdk_authentication.rbs +25 -3
  87. data/sig/plugins/aws_sigv4.rbs +13 -5
  88. data/sig/plugins/basic_authentication.rbs +1 -1
  89. data/sig/plugins/compression.rbs +4 -6
  90. data/sig/plugins/cookies/cookie.rbs +5 -7
  91. data/sig/plugins/cookies/jar.rbs +9 -10
  92. data/sig/plugins/cookies.rbs +4 -5
  93. data/sig/plugins/digest_authentication.rbs +2 -3
  94. data/sig/plugins/expect.rbs +2 -4
  95. data/sig/plugins/follow_redirects.rbs +3 -5
  96. data/sig/plugins/grpc.rbs +4 -7
  97. data/sig/plugins/h2c.rbs +0 -2
  98. data/sig/plugins/multipart.rbs +64 -10
  99. data/sig/plugins/ntlm_authentication.rbs +2 -3
  100. data/sig/plugins/persistent.rbs +3 -8
  101. data/sig/plugins/proxy/ssh.rbs +4 -4
  102. data/sig/plugins/proxy.rbs +13 -13
  103. data/sig/plugins/push_promise.rbs +0 -2
  104. data/sig/plugins/response_cache.rbs +35 -0
  105. data/sig/plugins/retries.rbs +7 -8
  106. data/sig/plugins/stream.rbs +1 -1
  107. data/sig/plugins/upgrade.rbs +2 -3
  108. data/sig/pool.rbs +7 -2
  109. data/sig/registry.rbs +1 -1
  110. data/sig/request.rbs +11 -8
  111. data/sig/resolver/native.rbs +10 -5
  112. data/sig/resolver/resolver_mixin.rbs +4 -5
  113. data/sig/resolver/system.rbs +4 -0
  114. data/sig/resolver.rbs +7 -0
  115. data/sig/response.rbs +26 -13
  116. data/sig/selector.rbs +11 -9
  117. data/sig/session.rbs +22 -23
  118. data/sig/timers.rbs +32 -0
  119. data/sig/transcoder/body.rbs +6 -1
  120. data/sig/transcoder/chunker.rbs +8 -2
  121. data/sig/transcoder/form.rbs +3 -1
  122. data/sig/transcoder/json.rbs +2 -0
  123. data/sig/transcoder.rbs +13 -5
  124. data/sig/utils.rbs +6 -0
  125. metadata +18 -18
  126. data/lib/httpx/request2.rb +0 -14
@@ -3,10 +3,13 @@ module HTTPX
3
3
  include Callbacks
4
4
  include Loggable
5
5
 
6
+ MAX_CONCURRENT_REQUESTS: Integer
7
+
6
8
  attr_reader streams: Hash[Request, HTTP2Next::Stream]
7
9
  attr_reader pending: Array[Request]
8
10
 
9
11
  @options: Options
12
+ @settings: Hash[Symbol, Integer | bool]
10
13
  @max_concurrent_requests: Integer
11
14
  @max_requests: Integer
12
15
  @drains: Hash[Request, String]
@@ -23,7 +26,7 @@ module HTTPX
23
26
 
24
27
  def <<: (String) -> void
25
28
 
26
- def can_buffer_more_requests: () -> bool
29
+ def can_buffer_more_requests?: () -> bool
27
30
 
28
31
  def send: (Request) -> void
29
32
 
@@ -35,7 +38,7 @@ module HTTPX
35
38
 
36
39
  alias reset init_connection
37
40
 
38
- def timeout: () -> Integer
41
+ def timeout: () -> Numeric
39
42
 
40
43
  private
41
44
 
@@ -45,7 +48,7 @@ module HTTPX
45
48
 
46
49
  def headline_uri: (Request) -> String
47
50
 
48
- def set_protocol_headers: (Request) -> _Each[headers_key, String]
51
+ def set_protocol_headers: (Request) -> _Each[[String, String]]
49
52
 
50
53
  def handle: (Request request, HTTP2Next::Stream stream) -> void
51
54
 
@@ -61,9 +64,11 @@ module HTTPX
61
64
 
62
65
  def on_stream_headers: (HTTP2Next::Stream stream, Request request, Array[[String, String]] headers) -> void
63
66
 
64
- def on_stream_trailers: (HTTP2Next::Stream stream, Request request, Array[[String, String]] headers) -> void
67
+ def on_stream_trailers: (HTTP2Next::Stream stream, Response response, Array[[String, String]] headers) -> void
68
+
69
+ def on_stream_data: (HTTP2Next::Stream stream, Request request, String data) -> void
65
70
 
66
- def on_stream_data: (HTTP2Next::Stream stream, Request request, string data) -> void
71
+ def on_stream_refuse: (HTTP2Next::Stream stream, Request request, StandardError error) -> void
67
72
 
68
73
  def on_stream_close: (HTTP2Next::Stream stream, Request request, (Symbol | StandardError)? error) -> void
69
74
 
@@ -74,12 +79,18 @@ module HTTPX
74
79
  def on_close: (Integer last_frame, Symbol? error, String? payload) -> void
75
80
 
76
81
  def on_frame_sent: (HTTP2Next::frame) -> void
82
+
77
83
  def on_frame_received: (HTTP2Next::frame) -> void
78
84
 
85
+ def on_altsvc: (String origin, HTTP2Next::frame) -> void
86
+
79
87
  def on_promise: (HTTP2Next::Stream) -> void
80
88
 
81
89
  def on_origin: (String) -> void
82
90
 
83
91
  def on_pong: (string ping) -> void
92
+
93
+ class Error < ::HTTPX::Error
94
+ end
84
95
  end
85
96
  end
data/sig/connection.rbs CHANGED
@@ -4,45 +4,62 @@ module HTTPX
4
4
 
5
5
  def on: (Symbol) { (*untyped) -> void } -> void
6
6
  def empty?: () -> bool
7
+ # def exhausted?: () -> bool
7
8
  def close: () -> void
8
9
  def consume: () -> void
9
10
  def <<: (string) -> void
11
+ # def send: (Request) -> void
12
+ # def ping: () -> void
13
+ # def timeout: () -> (Integer | Float)
14
+
10
15
  end
11
16
 
17
+ extend Forwardable
12
18
  include Loggable
13
19
  include Callbacks
14
- extend HTTPX::Registry[String, Class]
20
+ include HTTPX::Registry[String, Class]
21
+
22
+ BUFFER_SIZE: Integer
15
23
 
16
- attr_reader origin: generic_uri
24
+ attr_reader origin: URI::Generic
17
25
  attr_reader state: Symbol
18
26
  attr_reader pending: Array[Request]
19
- attr_reader options: options
27
+ attr_reader options: Options
28
+ attr_writer timers: Timers
29
+
30
+ @origins: Array[URI::Generic]
31
+ @window_size: Integer
32
+ @read_buffer: Buffer
33
+ @write_buffer: Buffer
34
+ @inflight: Integer
35
+ @keep_alive_timeout: Numeric?
36
+ @total_timeout: Numeric?
20
37
 
21
38
  def addresses: () -> Array[ipaddr]?
22
39
 
23
40
  def addresses=: (Array[ipaddr]) -> void
24
41
 
25
- def match?: (generic_uri, options) -> bool
42
+ def match?: (URI::Generic, options) -> bool
26
43
 
27
44
  def mergeable?: (Connection) -> bool
28
45
 
29
46
  def coalescable?: (Connection) -> bool
30
47
 
31
- def create_idle: (options) -> Connection
32
- | () -> Connection
48
+ def create_idle: (?Hash[Symbol, untyped] options) -> Connection
33
49
 
34
50
  def merge: (Connection) -> void
35
51
 
36
52
  def purge_pending: () { (Request) -> void } -> void
37
53
 
38
- def match_altsvcs?: (generic_uri) -> bool
54
+ def match_altsvcs?: (URI::Generic uri) -> bool
39
55
 
40
56
  def connecting?: () -> bool
57
+
41
58
  def inflight?: () -> boolish
42
59
 
43
60
  def interests: () -> io_interests?
44
61
 
45
- def to_io: () -> _ToIO
62
+ def to_io: () -> IO
46
63
 
47
64
  def call: () -> void
48
65
 
@@ -53,9 +70,10 @@ module HTTPX
53
70
 
54
71
  def timeout: () -> Numeric?
55
72
 
73
+ def deactivate: () -> void
56
74
  private
57
75
 
58
- def initialize: (String, generic_uri, options) -> untyped
76
+ def initialize: (String, URI::Generic, options) -> untyped
59
77
 
60
78
  def connect: () -> void
61
79
 
@@ -67,6 +85,8 @@ module HTTPX
67
85
 
68
86
  def parser: () -> _Parser
69
87
 
88
+ def send_request_to_parser: (Request request) -> void
89
+
70
90
  def build_parser: () -> _Parser
71
91
  | (String) -> _Parser
72
92
 
@@ -74,12 +94,10 @@ module HTTPX
74
94
 
75
95
  def transition: (Symbol) -> void
76
96
 
77
- def handle_response: () -> void
78
-
79
- def on_error: (StandardError) -> void
97
+ def on_error: (HTTPX::TimeoutError | Error | StandardError) -> void
80
98
 
81
99
  def handle_error: (StandardError) -> void
82
100
 
83
- def total_timeout: () -> Timers::Timer?
101
+ def purge_after_closed: () -> void
84
102
  end
85
103
  end
data/sig/errors.rbs CHANGED
@@ -1,3 +1,37 @@
1
1
  module HTTPX
2
- Error: singleton(StandardError)
2
+ class Error < StandardError
3
+ end
4
+
5
+ class TimeoutError < Error
6
+ attr_reader timeout: Numeric
7
+
8
+ def to_connection_error: () -> ConnectTimeoutError
9
+ private
10
+
11
+ def initialize: (Numeric timeout, String message) -> untyped
12
+ end
13
+
14
+ class TotalTimeoutError < TimeoutError
15
+ end
16
+
17
+ class ConnectTimeoutError < TimeoutError
18
+ end
19
+
20
+ class SettingsTimeoutError < TimeoutError
21
+ end
22
+
23
+ class ResolveTimeoutError < TimeoutError
24
+ end
25
+
26
+ class ResolveError < Error
27
+ end
28
+
29
+ class NativeResolveError < ResolveError
30
+ attr_reader connection: Connection
31
+ attr_reader host: String
32
+
33
+ private
34
+
35
+ def initialize: (Connection connection, String hostname, ?String message) -> untyped
36
+ end
3
37
  end
data/sig/headers.rbs CHANGED
@@ -2,44 +2,45 @@ module HTTPX
2
2
  class Headers
3
3
  include _ToS
4
4
 
5
- @headers: headers_hash
5
+ EMPTY: Array[untyped]
6
6
 
7
- def self.new: (?untyped headers) -> Headers
7
+ @headers: Hash[String, Array[String]]
8
+
9
+ def self.new: (?untyped headers) -> instance
8
10
 
9
11
  def ==: (untyped other) -> bool
10
12
 
11
- def []: (headers_key field) -> _ToS?
12
- def []=: (headers_key field, headers_value value) -> void
13
+ def []: (String field) -> String?
14
+ def []=: (String field, headers_value value) -> void
13
15
 
14
- def add: (headers_key field, string value) -> void
15
- def delete: (headers_key field) -> void
16
+ def add: (String field, string value) -> void
17
+ def delete: (String field) -> Array[String]?
16
18
 
17
- def each: (?_Each[headers_key, String]? extra_headers) { (headers_key, String) -> void } -> void
18
- | (?_Each[headers_key, String]? extra_headers) -> Enumerable[[headers_key, String], void]
19
+ def each: (?_Each[[String, String]]? extra_headers) { (String k, String v) -> void } -> void
20
+ | (?_Each[[String, String]]? extra_headers) -> Enumerable[[String, String]]
19
21
 
20
- def get: (headers_key field) -> Array[String]
21
- def key?: (headers_key downcased_key) -> bool
22
+ def get: (String field) -> Array[String]
23
+ def key?: (String downcased_key) -> bool
22
24
 
23
- def merge: (_Each[headers_key, headers_value] other) -> Headers
25
+ def merge: (_Each[[String, headers_value]] other) -> Headers
24
26
 
25
27
  def same_headers?: (untyped headers) -> bool
26
28
 
27
- def to_a: () -> Array[[headers_key, String]]
28
- def to_hash: () -> Hash[headers_key, String]
29
+ def to_a: () -> Array[[String, String]]
30
+ def to_hash: () -> Hash[String, String]
29
31
  alias to_h to_hash
30
32
 
31
- def inspect: () -> String
33
+ def inspect: () -> String
32
34
 
33
35
  private
34
36
 
35
- def initialize: (headers?) -> untyped
37
+ def initialize: (?headers?) -> untyped
36
38
  def array_value: (headers_value) -> Array[String]
37
- def downcased: (headers_key) -> String
39
+ def downcased: (_ToS field) -> String
38
40
  end
39
41
 
40
- type headers_key = String | Symbol
41
42
  type headers_value = _ToS | Array[_ToS]
42
- type headers_hash = Hash[headers_key, headers_value]
43
- type headers_input = headers_hash | Array[[headers_key, string]]
43
+ type headers_hash = Hash[_ToS, headers_value]
44
+ type headers_input = headers_hash | Array[[_ToS, string]]
44
45
  type headers = Headers | headers_input
45
46
  end
data/sig/httpx.rbs CHANGED
@@ -4,12 +4,15 @@ 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
+ type generic_uri = String | URI::Generic
8
8
 
9
9
  type verb = :options | :get | :head | :post | :put | :delete | :trace | :connect |
10
10
  :propfind | :proppatch | :mkcol | :copy | :move | :lock | :unlock | :orderpatch |
11
11
  :acl | :report | :patch | :search
12
12
 
13
13
  module Plugins
14
+ def self?.load_plugin: (Symbol) -> Module
15
+
16
+ def self?.register_plugin: (Symbol, Module) -> void
14
17
  end
15
18
  end
data/sig/loggable.rbs CHANGED
@@ -4,8 +4,10 @@ module HTTPX
4
4
  end
5
5
 
6
6
  module Loggable
7
+ COLORS: Hash[Symbol, Integer]
8
+
7
9
  def log: (?level: Integer?, ?color: Symbol?) { () -> String } -> void
8
10
 
9
- def log_exception: (StandardError, **untyped) -> void
11
+ def log_exception: (Exception error, ?level: Integer, ?color: Symbol) -> void
10
12
  end
11
13
  end
data/sig/options.rbs CHANGED
@@ -4,109 +4,120 @@ module HTTPX
4
4
 
5
5
  WINDOW_SIZE: Integer
6
6
  MAX_BODY_THRESHOLD_SIZE: Integer
7
+ CONNECT_TIMEOUT: Integer
8
+ OPERATION_TIMEOUT: Integer
9
+ KEEP_ALIVE_TIMEOUT: Integer
10
+ SETTINGS_TIMEOUT: Integer
11
+ DEFAULT_OPTIONS: Hash[Symbol, untyped]
7
12
 
8
13
  type timeout_type = :connect_timeout | :settings_timeout | :operation_timeout | :keep_alive_timeout | :total_timeout
9
- type timeout = Hash[timeout_type, Numeric?]
14
+ type timeout = Hash[timeout_type, Numeric]
10
15
 
11
- def self.new: (options) -> instance
12
- | () -> instance
16
+ def self.new: (?options) -> instance
13
17
 
18
+ def self.def_option: (Symbol, ?String) -> void
19
+ | (Symbol) { (*nil) -> untyped } -> void
14
20
  # headers
15
21
  attr_reader uri: URI?
16
- def uri=: (uri) -> void
17
22
 
18
23
  # headers
19
24
  attr_reader headers: Headers?
20
- def headers=: (headers) -> void
21
25
 
22
26
  # timeout
23
27
  attr_reader timeout: timeout
24
- def timeout=: (timeout) -> void
28
+
29
+ # http2_settings
30
+ attr_reader http2_settings: Hash[Symbol, Integer | bool]
25
31
 
26
32
  # max_concurrent_requests
27
33
  attr_reader max_concurrent_requests: Integer?
28
- def max_concurrent_requests=: (Integer) -> void
29
34
 
30
35
  # max_requests
31
36
  attr_reader max_requests: Integer?
32
- def max_requests=: (Integer) -> void
33
37
 
34
38
  # window_size
35
- attr_reader window_size: int?
36
- def window_size=: (int) -> void
39
+ attr_reader window_size: Integer
37
40
 
38
41
  # body_threshold_size
39
- attr_reader body_threshold_size: int?
40
- def body_threshold_size=: (int) -> void
42
+ attr_reader body_threshold_size: Integer
41
43
 
42
44
  # transport
43
- attr_reader transport: _ToS?
44
- def transport=: (_ToS) -> void
45
+ attr_reader transport: String?
45
46
 
46
47
  # transport_options
47
48
  attr_reader transport_options: Hash[untyped, untyped]?
48
- def transport_options=: (Hash[untyped, untyped]) -> void
49
49
 
50
50
  # addresses
51
- attr_reader addresses: _ToAry[untyped]?
52
- def addresses=: (_ToAry[untyped]) -> void
51
+ attr_reader addresses: Array[ipaddr]?
53
52
 
54
53
  # params
55
54
  attr_reader params: Transcoder::urlencoded_input?
56
- def params=: (Transcoder::urlencoded_input) -> void
57
55
 
58
56
  # form
59
57
  attr_reader form: Transcoder::urlencoded_input?
60
- def form=: (Transcoder::urlencoded_input) -> void
61
58
 
62
59
  # json
63
60
  attr_reader json: _ToJson?
64
- def json=: (_ToJson) -> void
65
61
 
66
62
  # body
67
63
  attr_reader body: bodyIO?
68
- def body=: (bodyIO) -> void
64
+
65
+ # body
66
+ attr_reader origin: URI::Generic?
69
67
 
70
68
  # ssl
71
69
 
72
70
  # http2_settings
73
71
 
72
+
73
+ # classes
74
+ attr_reader connection_class: singleton(Connection)
75
+
76
+ attr_reader request_class: singleton(Request)
77
+
78
+ attr_reader response_class: singleton(Response)
79
+
80
+ attr_reader headers_class: singleton(Headers)
81
+
82
+ attr_reader request_body_class: singleton(Request::Body)
83
+
84
+ attr_reader response_body_class: singleton(Response::Body)
85
+
86
+ attr_reader ssl: Hash[Symbol, untyped]
87
+
74
88
  # request_class response_class headers_class request_body_class
75
89
  # response_body_class connection_class
76
90
  # resolver_class resolver_options
77
91
 
78
- # request_class
79
- attr_reader request_class: singleton(Request)
80
- def request_class=: (singleton(Request)) -> void
81
-
82
92
  # io
83
93
  type io_option = _ToIO | Hash[String, _ToIO]
84
94
  attr_reader io: io_option?
85
- def io=: (io_option) -> void
86
95
 
87
96
  # fallback_protocol
88
97
  attr_reader fallback_protocol: String?
89
- def fallback_protocol=: (String) -> void
90
98
 
91
99
  # debug
92
100
  attr_reader debug: _IOLogger?
93
- def debug=: (_IOLogger) -> void
94
101
 
95
102
  # debug_level
96
- attr_reader debug_level: Integer?
97
- def debug_level=: (Integer) -> void
103
+ attr_reader debug_level: Integer
98
104
 
99
105
  # persistent
100
106
  attr_reader persistent: bool?
101
- def persistent=: (bool) -> void
107
+
108
+ # resolver_options
109
+ attr_reader resolver_options: Hash[Symbol, untyped]?
102
110
 
103
111
  def ==: (untyped other) -> bool
104
- def merge: (_ToHash other) -> instance
112
+ def merge: (_ToHash[Symbol, untyped] other) -> instance
113
+ def to_hash: () -> Hash[Symbol, untyped]
105
114
 
106
115
  private
107
116
 
108
- def initialize: (options) -> untyped
117
+ REQUEST_IVARS: Array[Symbol]
118
+
119
+ def initialize: (?options options) -> untyped
109
120
  end
110
121
 
111
- type options = Options | Hash[Symbol | String, untyped]
122
+ type options = Options | Hash[Symbol, untyped]
112
123
  end
data/sig/parser/http1.rbs CHANGED
@@ -5,9 +5,9 @@ module HTTPX
5
5
  interface _HTTP1Events
6
6
 
7
7
  def on_start: () -> void
8
- def on_headers: (parsed_headers) -> void
9
- def on_trailers: (parsed_headers) -> void
10
- def on_data: (String) -> void
8
+ def on_headers: (parsed_headers headers) -> void
9
+ def on_trailers: (parsed_headers trailers) -> void
10
+ def on_data: (String data) -> void
11
11
  def on_complete: () -> void
12
12
  end
13
13
 
@@ -6,6 +6,6 @@ module HTTPX
6
6
  end
7
7
  end
8
8
 
9
- type sessionAuthentication = Session & Plugins::Authentication::InstanceMethods
9
+ type sessionAuthentication = Session & Authentication::InstanceMethods
10
10
  end
11
11
  end
@@ -1,21 +1,43 @@
1
1
  module HTTPX
2
2
  module Plugins
3
3
  module AwsSdkAuthentication
4
+ class Configuration
5
+ attr_reader profile: String?
6
+
7
+ private
8
+
9
+ def initialize: (String? profile) -> void
10
+ end
11
+
4
12
  class Credentials
13
+ @aws_credentials: untyped
14
+
5
15
  include _SigV4Credentials
16
+
17
+ private
18
+
19
+ def initialize: (untyped aws_credentials) -> untyped
20
+ end
21
+
22
+ interface _AwsSdkOptions
23
+ def aws_profile: () -> String?
6
24
  end
7
25
 
8
26
  def self.load_dependencies: (singleton(Session)) -> void
9
27
 
10
28
  def self.configure: (singleton(Session)) -> void
11
29
 
12
- def self.extra_options: (Options) -> (Options)
30
+ def self.extra_options: (Options) -> (Options & _AwsSdkOptions)
31
+
32
+ def self.credentials: (String? profile) -> Credentials
33
+
34
+ def self.region: (String? profile) -> String
13
35
 
14
36
  module InstanceMethods
15
- def aws_sdk_authentication: (**untyped) -> instance
37
+ def aws_sdk_authentication: (?credentials: Credentials, ?region: String, **untyped) -> instance
16
38
  end
17
39
  end
18
40
 
19
- type sessionAwsSdkAuthentication = Session & Plugins::AwsSdkAuthentication::InstanceMethods
41
+ type sessionAwsSdkAuthentication = awsSigV4Session & AwsSdkAuthentication::InstanceMethods
20
42
  end
21
43
  end
@@ -9,13 +9,21 @@ module HTTPX
9
9
 
10
10
  module AWSSigV4
11
11
 
12
- Credentials: _SigV4Credentials
12
+ class Credentials < Struct[[String, String, String?]]
13
+ attr_reader username: String
14
+ attr_reader password: String
15
+ attr_reader security_token: String?
16
+ end
13
17
 
14
18
 
15
19
  class Signer
16
20
 
17
- def sign!: (Request) -> void
21
+ @unsigned_headers: Set[String]
22
+
23
+ def sign!: (Request & RequestMethods request) -> void
18
24
 
25
+ def self.new: (instance) -> instance
26
+ | (**untyped params) -> instance
19
27
  private
20
28
 
21
29
  def initialize: (
@@ -33,16 +41,16 @@ module HTTPX
33
41
  ) -> untyped
34
42
 
35
43
 
36
- def sha256_hexdigest: (bodyIO value) -> String
44
+ def hexdigest: (bodyIO value) -> String
37
45
 
38
46
  def hmac: (String key, String value) -> String
47
+
39
48
  def hexhmac: (String key, String value) -> String
40
49
  end
41
50
 
42
51
 
43
52
  interface _SigV4Options
44
53
  def sigv4_signer: () -> Signer?
45
- def sigv4_signer=: (Signer) -> Signer
46
54
  end
47
55
 
48
56
  def self.extra_options: (Options) -> (Options & _SigV4Options)
@@ -59,6 +67,6 @@ module HTTPX
59
67
  end
60
68
  end
61
69
 
62
- type awsSigV4Session = Session & Plugins::AWSSigV4::InstanceMethods
70
+ type awsSigV4Session = Session & AWSSigV4::InstanceMethods
63
71
  end
64
72
  end
@@ -10,6 +10,6 @@ module HTTPX
10
10
  end
11
11
  end
12
12
 
13
- type sessionBasicAuthentication = Plugins::sessionAuthentication & Plugins::BasicAuthentication::InstanceMethods
13
+ type sessionBasicAuthentication = sessionAuthentication & Authentication::InstanceMethods & BasicAuthentication::InstanceMethods
14
14
  end
15
15
  end
@@ -15,23 +15,21 @@ module HTTPX
15
15
 
16
16
  def initialize: (Numeric bytesize) -> untyped
17
17
  end
18
-
18
+
19
19
  def self.configure: (singleton(Session)) -> void
20
20
 
21
21
  interface _CompressionOptions
22
- def compression_threshold_size: () -> _Integer?
23
- def compression_threshold_size=: (int) -> int
22
+ def compression_threshold_size: () -> Integer?
24
23
 
25
24
  def encodings: () -> encodings_registry?
26
- def encodings=: (encodings_registry) -> encodings_registry
27
25
  end
28
-
26
+
29
27
  def self.extra_options: (Options) -> (Options & _CompressionOptions)
30
28
 
31
29
 
32
30
  module ResponseBodyMethods
33
31
  @encodings: Array[String]
34
- @_deflaters: Array[_Decoder]
32
+ @_deflaters: Array[_Deflater]
35
33
 
36
34
  private
37
35
 
@@ -31,19 +31,17 @@ module HTTPX
31
31
 
32
32
  def valid_for_uri?: (uri) -> bool
33
33
 
34
- def self.new: (Cookie) -> untyped
35
- | (cookie_attributes) -> untyped
36
- | (String, String) -> untyped
37
- | (String, String, cookie_attributes) -> untyped
34
+ def self.new: (Cookie) -> instance
35
+ | (cookie_attributes) -> instance
36
+ | (_ToS, _ToS, ?cookie_attributes) -> instance
38
37
 
39
38
  def self.path_match?: (String, String) -> bool
40
39
 
41
40
  private
42
41
 
43
42
  def initialize: (cookie_attributes) -> untyped
44
- | (String, String) -> untyped
45
- | (String, String, cookie_attributes?) -> untyped
46
-
43
+ | (_ToS, _ToS, ?cookie_attributes) -> untyped
44
+
47
45
  def acceptable_from_uri?: (uri) -> bool
48
46
  end
49
47
  end