httpx 1.1.4 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +5 -5
  3. data/doc/release_notes/1_1_4.md +1 -1
  4. data/doc/release_notes/1_1_5.md +12 -0
  5. data/doc/release_notes/1_2_0.md +49 -0
  6. data/lib/httpx/adapters/webmock.rb +29 -8
  7. data/lib/httpx/altsvc.rb +57 -2
  8. data/lib/httpx/chainable.rb +40 -29
  9. data/lib/httpx/connection/http1.rb +27 -22
  10. data/lib/httpx/connection/http2.rb +7 -3
  11. data/lib/httpx/connection.rb +45 -60
  12. data/lib/httpx/extensions.rb +0 -15
  13. data/lib/httpx/options.rb +84 -27
  14. data/lib/httpx/plugins/aws_sigv4.rb +2 -2
  15. data/lib/httpx/plugins/basic_auth.rb +1 -1
  16. data/lib/httpx/plugins/callbacks.rb +91 -0
  17. data/lib/httpx/plugins/circuit_breaker.rb +2 -0
  18. data/lib/httpx/plugins/cookies.rb +19 -9
  19. data/lib/httpx/plugins/digest_auth.rb +1 -1
  20. data/lib/httpx/plugins/follow_redirects.rb +11 -0
  21. data/lib/httpx/plugins/grpc/call.rb +2 -3
  22. data/lib/httpx/plugins/grpc/grpc_encoding.rb +1 -0
  23. data/lib/httpx/plugins/grpc.rb +2 -2
  24. data/lib/httpx/plugins/h2c.rb +20 -8
  25. data/lib/httpx/plugins/proxy/socks4.rb +2 -2
  26. data/lib/httpx/plugins/proxy/socks5.rb +2 -2
  27. data/lib/httpx/plugins/proxy.rb +14 -32
  28. data/lib/httpx/plugins/rate_limiter.rb +1 -1
  29. data/lib/httpx/plugins/retries.rb +4 -0
  30. data/lib/httpx/plugins/ssrf_filter.rb +142 -0
  31. data/lib/httpx/plugins/stream.rb +9 -4
  32. data/lib/httpx/plugins/upgrade/h2.rb +1 -1
  33. data/lib/httpx/plugins/upgrade.rb +1 -1
  34. data/lib/httpx/plugins/webdav.rb +1 -1
  35. data/lib/httpx/pool.rb +32 -28
  36. data/lib/httpx/request/body.rb +3 -3
  37. data/lib/httpx/request.rb +12 -3
  38. data/lib/httpx/resolver/https.rb +3 -2
  39. data/lib/httpx/resolver/native.rb +1 -0
  40. data/lib/httpx/resolver/resolver.rb +17 -6
  41. data/lib/httpx/response.rb +1 -1
  42. data/lib/httpx/session.rb +13 -82
  43. data/lib/httpx/timers.rb +3 -10
  44. data/lib/httpx/transcoder.rb +1 -1
  45. data/lib/httpx/version.rb +1 -1
  46. data/sig/altsvc.rbs +33 -0
  47. data/sig/chainable.rbs +1 -0
  48. data/sig/connection/http1.rbs +2 -1
  49. data/sig/connection.rbs +16 -16
  50. data/sig/options.rbs +10 -2
  51. data/sig/plugins/callbacks.rbs +38 -0
  52. data/sig/plugins/cookies.rbs +2 -0
  53. data/sig/plugins/follow_redirects.rbs +2 -0
  54. data/sig/plugins/proxy/socks4.rbs +2 -1
  55. data/sig/plugins/proxy/socks5.rbs +2 -1
  56. data/sig/plugins/proxy.rbs +11 -1
  57. data/sig/plugins/stream.rbs +24 -22
  58. data/sig/pool.rbs +1 -3
  59. data/sig/resolver/resolver.rbs +3 -1
  60. data/sig/session.rbs +4 -4
  61. metadata +12 -4
data/lib/httpx/session.rb CHANGED
@@ -8,7 +8,6 @@ module HTTPX
8
8
  class Session
9
9
  include Loggable
10
10
  include Chainable
11
- include Callbacks
12
11
 
13
12
  EMPTY_HASH = {}.freeze
14
13
 
@@ -85,33 +84,7 @@ module HTTPX
85
84
  options = @options.merge(options) unless options.is_a?(Options)
86
85
  request = rklass.new(verb, uri, options)
87
86
  request.persistent = @persistent
88
- request.on(:response, &method(:on_response).curry(2)[request])
89
- request.on(:promise, &method(:on_promise))
90
-
91
- request.on(:headers) do
92
- emit(:request_started, request)
93
- end
94
- request.on(:body_chunk) do |chunk|
95
- emit(:request_body_chunk, request, chunk)
96
- end
97
- request.on(:done) do
98
- emit(:request_completed, request)
99
- end
100
-
101
- request.on(:response_started) do |res|
102
- if res.is_a?(Response)
103
- emit(:response_started, request, res)
104
- res.on(:chunk_received) do |chunk|
105
- emit(:response_body_chunk, request, res, chunk)
106
- end
107
- else
108
- emit(:request_error, request, res.error)
109
- end
110
- end
111
- request.on(:response) do |res|
112
- emit(:response_completed, request, res)
113
- end
114
-
87
+ set_request_callbacks(request)
115
88
  request
116
89
  end
117
90
 
@@ -143,7 +116,7 @@ module HTTPX
143
116
  def find_connection(request, connections, options)
144
117
  uri = request.uri
145
118
 
146
- connection = pool.find_connection(uri, options) || build_connection(uri, options)
119
+ connection = pool.find_connection(uri, options) || init_connection(uri, options)
147
120
  unless connections.nil? || connections.include?(connection)
148
121
  connections << connection
149
122
  set_connection_callbacks(connection, connections, options)
@@ -179,15 +152,6 @@ module HTTPX
179
152
  other_connection = build_altsvc_connection(connection, connections, alt_origin, origin, alt_params, options)
180
153
  connections << other_connection if other_connection
181
154
  end
182
- connection.only(:exhausted) do
183
- other_connection = connection.create_idle
184
- other_connection.merge(connection)
185
- catch(:coalesced) do
186
- pool.init_connection(other_connection, options)
187
- end
188
- set_connection_callbacks(other_connection, connections, options)
189
- connections << other_connection
190
- end
191
155
  end
192
156
 
193
157
  # returns an HTTPX::Connection for the negotiated Alternative Service (or none).
@@ -202,24 +166,19 @@ module HTTPX
202
166
 
203
167
  alt_options = options.merge(ssl: options.ssl.merge(hostname: URI(origin).host))
204
168
 
205
- connection = pool.find_connection(alt_origin, alt_options) || build_connection(alt_origin, alt_options)
169
+ connection = pool.find_connection(alt_origin, alt_options) || init_connection(alt_origin, alt_options)
170
+
206
171
  # advertised altsvc is the same origin being used, ignore
207
172
  return if connection == existing_connection
208
173
 
174
+ connection.extend(AltSvc::ConnectionMixin) unless connection.is_a?(AltSvc::ConnectionMixin)
175
+
209
176
  set_connection_callbacks(connection, connections, alt_options)
210
177
 
211
178
  log(level: 1) { "#{origin} alt-svc: #{alt_origin}" }
212
179
 
213
- # get uninitialized requests
214
- # incidentally, all requests will be re-routed to the first
215
- # advertised alt-svc, which incidentally follows the spec.
216
- existing_connection.purge_pending do |request|
217
- request.origin == origin &&
218
- request.state == :idle &&
219
- !request.headers.key?("alt-used")
220
- end
221
-
222
180
  connection.merge(existing_connection)
181
+ existing_connection.terminate
223
182
  connection
224
183
  rescue UnsupportedSchemeError
225
184
  altsvc["noop"] = true
@@ -250,30 +209,13 @@ module HTTPX
250
209
  requests
251
210
  end
252
211
 
253
- # returns a new HTTPX::Connection object for the given +uri+ and set of +options+.
254
- def build_connection(uri, options)
255
- type = options.transport || begin
256
- case uri.scheme
257
- when "http"
258
- "tcp"
259
- when "https"
260
- "ssl"
261
- else
262
- raise UnsupportedSchemeError, "#{uri}: #{uri.scheme}: unsupported URI scheme"
263
- end
264
- end
265
- init_connection(type, uri, options)
212
+ def set_request_callbacks(request)
213
+ request.on(:response, &method(:on_response).curry(2)[request])
214
+ request.on(:promise, &method(:on_promise))
266
215
  end
267
216
 
268
- def init_connection(type, uri, options)
269
- connection = options.connection_class.new(type, uri, options)
270
- connection.on(:open) do
271
- emit(:connection_opened, connection.origin, connection.io.socket)
272
- # only run close callback if it opened
273
- end
274
- connection.on(:close) do
275
- emit(:connection_closed, connection.origin, connection.io.socket) if connection.used?
276
- end
217
+ def init_connection(uri, options)
218
+ connection = options.connection_class.new(uri, options)
277
219
  catch(:coalesced) do
278
220
  pool.init_connection(connection, options)
279
221
  connection
@@ -369,19 +311,8 @@ module HTTPX
369
311
  extend(pl::ClassMethods) if defined?(pl::ClassMethods)
370
312
 
371
313
  opts = @default_options
372
- opts.request_class.__send__(:include, pl::RequestMethods) if defined?(pl::RequestMethods)
373
- opts.request_class.extend(pl::RequestClassMethods) if defined?(pl::RequestClassMethods)
374
- opts.response_class.__send__(:include, pl::ResponseMethods) if defined?(pl::ResponseMethods)
375
- opts.response_class.extend(pl::ResponseClassMethods) if defined?(pl::ResponseClassMethods)
376
- opts.headers_class.__send__(:include, pl::HeadersMethods) if defined?(pl::HeadersMethods)
377
- opts.headers_class.extend(pl::HeadersClassMethods) if defined?(pl::HeadersClassMethods)
378
- opts.request_body_class.__send__(:include, pl::RequestBodyMethods) if defined?(pl::RequestBodyMethods)
379
- opts.request_body_class.extend(pl::RequestBodyClassMethods) if defined?(pl::RequestBodyClassMethods)
380
- opts.response_body_class.__send__(:include, pl::ResponseBodyMethods) if defined?(pl::ResponseBodyMethods)
381
- opts.response_body_class.extend(pl::ResponseBodyClassMethods) if defined?(pl::ResponseBodyClassMethods)
382
- opts.connection_class.__send__(:include, pl::ConnectionMethods) if defined?(pl::ConnectionMethods)
314
+ opts.extend_with_plugin_classes(pl)
383
315
  if defined?(pl::OptionsMethods)
384
- opts.options_class.__send__(:include, pl::OptionsMethods)
385
316
 
386
317
  (pl::OptionsMethods.instance_methods - Object.instance_methods).each do |meth|
387
318
  opts.options_class.method_added(meth)
data/lib/httpx/timers.rb CHANGED
@@ -81,16 +81,9 @@ module HTTPX
81
81
  @callbacks << callback
82
82
  end
83
83
 
84
- if RUBY_ENGINE == "jruby" && JRUBY_VERSION < "9.4.5.0"
85
- # https://github.com/jruby/jruby/issues/7976
86
- def delete(callback)
87
- @callbacks.delete(callback)
88
- end
89
- else
90
- def delete(callback)
91
- @callbacks.delete(callback)
92
- @on_empty.call if @callbacks.empty?
93
- end
84
+ def delete(callback)
85
+ @callbacks.delete(callback)
86
+ @on_empty.call if @callbacks.empty?
94
87
  end
95
88
 
96
89
  def no_callbacks?
@@ -5,7 +5,7 @@ module HTTPX
5
5
  module_function
6
6
 
7
7
  def normalize_keys(key, value, cond = nil, &block)
8
- if (cond && cond.call(value))
8
+ if cond && cond.call(value)
9
9
  block.call(key.to_s, value)
10
10
  elsif value.respond_to?(:to_ary)
11
11
  if value.empty?
data/lib/httpx/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HTTPX
4
- VERSION = "1.1.4"
4
+ VERSION = "1.2.0"
5
5
  end
data/sig/altsvc.rbs ADDED
@@ -0,0 +1,33 @@
1
+ module HTTPX
2
+ module AltSvc
3
+ module ConnectionMixin
4
+
5
+ def send: (Request request) -> void
6
+
7
+ def match?: (URI::Generic uri, Options options) -> bool
8
+
9
+ private
10
+
11
+ def match_altsvcs?: (URI::Generic uri) -> bool
12
+
13
+ def match_altsvc_options?: (URI::Generic uri, Options options) -> bool
14
+ end
15
+
16
+ type altsvc_params = Hash[String, untyped]
17
+
18
+ def self?.cached_altsvc: (String origin) -> Array[altsvc_params]
19
+
20
+ def self?.cached_altsvc_set: (String origin, altsvc_params) -> void
21
+
22
+ def self?.lookup: (String origin, Integer | Float ttl) -> Array[altsvc_params]
23
+
24
+ def self?.emit: (Request request, response response) { (http_uri alt_origin, String origin, altsvc_params alt_params) -> void } -> void
25
+
26
+ def self?.parse: (String altsvc) { (http_uri alt_origin, altsvc_params alt_params) -> void } -> void
27
+ | (String altsvc) -> Enumerable[[http_uri, altsvc_params]]
28
+
29
+ def self?.parse_altsvc_scheme: (String alt_proto) -> String?
30
+
31
+ def self.parse_altsvc_origin: (string alt_proto, String alt_origin) -> http_uri?
32
+ end
33
+ end
data/sig/chainable.rbs CHANGED
@@ -34,6 +34,7 @@ module HTTPX
34
34
  | (:response_cache, ?options) -> Plugins::sessionResponseCache
35
35
  | (:circuit_breaker, ?options) -> Plugins::sessionCircuitBreaker
36
36
  | (:oauth, ?options) -> Plugins::sessionOAuth
37
+ | (:callbacks, ?options) -> Plugins::sessionCallbacks
37
38
  | (Symbol | Module, ?options) { (Class) -> void } -> Session
38
39
  | (Symbol | Module, ?options) -> Session
39
40
 
@@ -10,8 +10,9 @@ module HTTPX
10
10
  attr_reader pending: Array[Request]
11
11
  attr_reader requests: Array[Request]
12
12
 
13
+ attr_accessor max_concurrent_requests: Integer
14
+
13
15
  @options: Options
14
- @max_concurrent_requests: Integer
15
16
  @max_requests: Integer
16
17
  @parser: Parser::HTTP1
17
18
  @buffer: Buffer
data/sig/connection.rbs CHANGED
@@ -44,25 +44,23 @@ module HTTPX
44
44
 
45
45
  def addresses: () -> Array[ipaddr]?
46
46
 
47
- def addresses=: (Array[ipaddr]) -> void
47
+ def addresses=: (Array[ipaddr] addresses) -> void
48
+
49
+ def send: (Request request) -> void
48
50
 
49
51
  def match?: (URI::Generic uri, Options options) -> bool
50
52
 
51
53
  def expired?: () -> boolish
52
54
 
53
- def mergeable?: (Connection) -> bool
55
+ def mergeable?: (Connection connection) -> bool
54
56
 
55
- def coalescable?: (Connection) -> bool
57
+ def coalescable?: (Connection connection) -> bool
56
58
 
57
59
  def create_idle: (?Hash[Symbol, untyped] options) -> Connection
58
60
 
59
- def merge: (Connection) -> void
60
-
61
- def purge_pending: () { (Request) -> void } -> void
62
-
63
- def match_altsvcs?: (URI::Generic uri) -> bool
61
+ def merge: (Connection connection) -> void
64
62
 
65
- def match_altsvc_options?: (URI::Generic uri, Options options) -> bool
63
+ def purge_pending: () { (Request request) -> void } -> void
66
64
 
67
65
  def connecting?: () -> bool
68
66
 
@@ -74,12 +72,12 @@ module HTTPX
74
72
 
75
73
  def call: () -> void
76
74
 
75
+ def terminate: () -> void
76
+
77
77
  def close: () -> void
78
78
 
79
79
  def reset: () -> void
80
80
 
81
- def send: (Request) -> void
82
-
83
81
  def timeout: () -> Numeric?
84
82
 
85
83
  def idling: () -> void
@@ -94,7 +92,9 @@ module HTTPX
94
92
 
95
93
  private
96
94
 
97
- def initialize: (io_type, URI::Generic, options) -> untyped
95
+ def initialize: (URI::Generic uri, options) -> void
96
+
97
+ def initialize_type: (URI::Generic uri, options) -> io_type
98
98
 
99
99
  def connect: () -> void
100
100
 
@@ -112,15 +112,15 @@ module HTTPX
112
112
 
113
113
  def set_parser_callbacks: (HTTP1 | HTTP2 parser) -> void
114
114
 
115
- def transition: (Symbol) -> void
115
+ def transition: (Symbol nextstate) -> void
116
116
 
117
- def handle_transition: (Symbol) -> void
117
+ def handle_transition: (Symbol nextstate) -> void
118
118
 
119
119
  def build_socket: (?Array[ipaddr]? addrs) -> (TCP | SSL | UNIX)
120
120
 
121
- def on_error: (HTTPX::TimeoutError | Error | StandardError) -> void
121
+ def on_error: (HTTPX::TimeoutError | Error | StandardError error) -> void
122
122
 
123
- def handle_error: (StandardError) -> void
123
+ def handle_error: (StandardError error) -> void
124
124
 
125
125
  def purge_after_closed: () -> void
126
126
 
data/sig/options.rbs CHANGED
@@ -9,9 +9,11 @@ module HTTPX
9
9
  OPERATION_TIMEOUT: Integer
10
10
  KEEP_ALIVE_TIMEOUT: Integer
11
11
  SETTINGS_TIMEOUT: Integer
12
+ CLOSE_HANDSHAKE_TIMEOUT: Integer
12
13
  DEFAULT_OPTIONS: Hash[Symbol, untyped]
14
+ REQUEST_BODY_IVARS: Array[Symbol]
13
15
 
14
- type timeout_type = :connect_timeout | :settings_timeout | :operation_timeout | :keep_alive_timeout | :read_timeout | :write_timeout | :request_timeout
16
+ type timeout_type = :connect_timeout | :settings_timeout | :close_handshake_timeout | :operation_timeout | :keep_alive_timeout | :read_timeout | :write_timeout | :request_timeout
15
17
  type timeout = Hash[timeout_type, Numeric?]
16
18
 
17
19
  def self.new: (?options) -> instance
@@ -120,10 +122,16 @@ module HTTPX
120
122
  # ip_families
121
123
  attr_reader ip_families: Array[ip_family]
122
124
 
123
- def ==: (untyped other) -> bool
125
+ def ==: (Options other) -> bool
126
+
127
+ def options_equals?: (Options other, ?Array[Symbol] ignore_ivars) -> bool
128
+
124
129
  def merge: (_ToHash[Symbol, untyped] other) -> instance
130
+
125
131
  def to_hash: () -> Hash[Symbol, untyped]
126
132
 
133
+ def extend_with_plugin_classes: (Module pl) -> void
134
+
127
135
  private
128
136
 
129
137
  REQUEST_IVARS: Array[Symbol]
@@ -0,0 +1,38 @@
1
+ module HTTPX
2
+ module Plugins
3
+ module Callbacks
4
+ class CallbackError < Exception
5
+ end
6
+
7
+ module InstanceMethods
8
+ include HTTPX::Callbacks
9
+
10
+ type socket = TCPSocket | SSLSocket | UNIXSocket
11
+
12
+ def on_connection_opened: () { (http_uri origin, socket sock) -> void } -> self
13
+
14
+ def on_connection_closed: () { (http_uri origin) -> void } -> self
15
+
16
+ def on_request_error: () { (Request request, StandardError error) -> void } -> self
17
+
18
+ def on_request_started: () { (Request request) -> void } -> self
19
+
20
+ def on_request_body_chunk: () { (Request request, String chunk) -> void } -> self
21
+
22
+ def on_request_completed: () { (Request request) -> void } -> self
23
+
24
+ def on_response_started: () { (Request request, Response response) -> void } -> self
25
+
26
+ def on_response_body_chunk: () { (Request request, Response response, String chunk) -> void } -> self
27
+
28
+ def on_response_completed: () { (Request request, response response) -> void } -> self
29
+
30
+ private
31
+
32
+ def emit_or_callback_error: (*untyped) -> void
33
+ end
34
+ end
35
+
36
+ type sessionCallbacks = Session & Callbacks::InstanceMethods
37
+ end
38
+ end
@@ -5,6 +5,8 @@ module HTTPX
5
5
 
6
6
  interface _CookieOptions
7
7
  def cookies: () -> Jar?
8
+
9
+ def merge_cookie_in_jar: (Array[String] cookies, Jar jar) -> void
8
10
  end
9
11
 
10
12
  def self.extra_options: (Options) -> (Options & _CookieOptions)
@@ -12,6 +12,8 @@ module HTTPX
12
12
  def follow_insecure_redirects: () -> bool?
13
13
 
14
14
  def allow_auth_to_other_origins: () -> bool?
15
+
16
+ def redirect_on: (http_uri) -> bool?
15
17
  end
16
18
 
17
19
  def self.extra_options: (Options) -> (Options & _FollowRedirectsOptions)
@@ -1,5 +1,6 @@
1
1
  module HTTPX
2
- Socks4Error: singleton(Error)
2
+ class Socks4Error < HTTPProxyError
3
+ end
3
4
 
4
5
  module Plugins
5
6
  module Proxy
@@ -1,5 +1,6 @@
1
1
  module HTTPX
2
- Socks5Error: singleton(Error)
2
+ class Socks5Error < HTTPProxyError
3
+ end
3
4
 
4
5
  module Plugins
5
6
  module Proxy
@@ -1,5 +1,8 @@
1
1
  module HTTPX
2
- class HTTPProxyError < Error
2
+ class HTTPProxyError < ConnectionError
3
+ end
4
+
5
+ class ProxySSL < SSL
3
6
  end
4
7
 
5
8
  module Plugins
@@ -36,6 +39,13 @@ module HTTPX
36
39
 
37
40
  module InstanceMethods
38
41
  @__proxy_uris: Array[generic_uri]
42
+
43
+ private
44
+
45
+ def proxy_error?: (Request request, response) -> bool
46
+ end
47
+
48
+ module ConnectionMethods
39
49
  end
40
50
  end
41
51
 
@@ -1,26 +1,4 @@
1
1
  module HTTPX
2
- class StreamResponse
3
- include _ToS
4
-
5
- @request: Request & RequestMethods
6
- @session: sessionStream
7
- @on_chunk: ^(String) -> void | nil
8
-
9
- def each: () { (String) -> void } -> void
10
- | () -> Enumerable[String]
11
-
12
- def each_line: () { (String) -> void } -> void
13
- | () -> Enumerable[String]
14
-
15
- def on_chunk: (string) -> void
16
-
17
- def initialize: (Request, Session) -> void
18
-
19
- private
20
-
21
- def response: () -> response
22
- end
23
-
24
2
  module Plugins
25
3
  module Stream
26
4
  module InstanceMethods
@@ -42,4 +20,28 @@ module HTTPX
42
20
 
43
21
  type sessionStream = Session & Stream::InstanceMethods
44
22
  end
23
+
24
+ class StreamResponse
25
+ include _ToS
26
+
27
+ type streamRequest = Request & Plugins::Stream::RequestMethods
28
+
29
+ @request: streamRequest
30
+ @session: Plugins::sessionStream
31
+ @on_chunk: ^(String) -> void | nil
32
+
33
+ def each: () { (String) -> void } -> void
34
+ | () -> Enumerable[String]
35
+
36
+ def each_line: () { (String) -> void } -> void
37
+ | () -> Enumerable[String]
38
+
39
+ def on_chunk: (string) -> void
40
+
41
+ def initialize: (streamRequest, Plugins::sessionStream) -> void
42
+
43
+ private
44
+
45
+ def response: () -> response
46
+ end
45
47
  end
data/sig/pool.rbs CHANGED
@@ -6,8 +6,6 @@ module HTTPX
6
6
  @timers: Timers
7
7
  @selector: Selector
8
8
  @connections: Array[Connection]
9
- @eden_connections: Array[Connection]
10
- @connected_connections: Integer
11
9
 
12
10
  def empty?: () -> void
13
11
 
@@ -37,7 +35,7 @@ module HTTPX
37
35
 
38
36
  def register_connection: (Connection) -> void
39
37
 
40
- def unregister_connection: (Connection) -> void
38
+ def unregister_connection: (Connection, ?bool cleanup) -> void
41
39
 
42
40
  def select_connection: (Selector::selectable) -> void
43
41
 
@@ -14,6 +14,8 @@ module HTTPX
14
14
 
15
15
  def close: () -> void
16
16
 
17
+ alias terminate close
18
+
17
19
  def closed?: () -> bool
18
20
 
19
21
  def empty?: () -> bool
@@ -22,7 +24,7 @@ module HTTPX
22
24
 
23
25
  private
24
26
 
25
- def emit_resolved_connection: (Connection connection, Array[IPAddr] addresses) -> void
27
+ def emit_resolved_connection: (Connection connection, Array[IPAddr] addresses, bool early_resolve) -> void
26
28
 
27
29
  def initialize: (ip_family? family, options options) -> void
28
30
 
data/sig/session.rbs CHANGED
@@ -33,7 +33,9 @@ module HTTPX
33
33
 
34
34
  def set_connection_callbacks: (Connection connection, Array[Connection] connections, Options options) -> void
35
35
 
36
- def build_altsvc_connection: (Connection existing_connection, Array[Connection] connections, URI::Generic alt_origin, String origin, Hash[String, String] alt_params, Options options) -> Connection?
36
+ def set_request_callbacks: (Request request) -> void
37
+
38
+ def build_altsvc_connection: (Connection existing_connection, Array[Connection] connections, URI::Generic alt_origin, String origin, Hash[String, String] alt_params, Options options) -> (Connection & AltSvc::ConnectionMixin)?
37
39
 
38
40
  def build_requests: (verb, uri, options) -> Array[Request]
39
41
  | (Array[[verb, uri, options]], options) -> Array[Request]
@@ -41,9 +43,7 @@ module HTTPX
41
43
  | (verb, _Each[[uri, options]], Options) -> Array[Request]
42
44
  | (verb, _Each[uri], options) -> Array[Request]
43
45
 
44
- def build_connection: (URI::HTTP | URI::HTTP uri, Options options) -> Connection
45
-
46
- def init_connection: (String type, URI::HTTP | URI::HTTP uri, Options options) -> Connection
46
+ def init_connection: (URI::HTTP | URI::HTTP uri, Options options) -> Connection
47
47
 
48
48
  def send_requests: (*Request) -> Array[response]
49
49
 
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.1.4
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tiago Cardoso
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-20 00:00:00.000000000 Z
11
+ date: 2023-12-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http-2-next
@@ -136,6 +136,8 @@ extra_rdoc_files:
136
136
  - doc/release_notes/1_1_2.md
137
137
  - doc/release_notes/1_1_3.md
138
138
  - doc/release_notes/1_1_4.md
139
+ - doc/release_notes/1_1_5.md
140
+ - doc/release_notes/1_2_0.md
139
141
  files:
140
142
  - LICENSE.txt
141
143
  - README.md
@@ -243,6 +245,8 @@ files:
243
245
  - doc/release_notes/1_1_2.md
244
246
  - doc/release_notes/1_1_3.md
245
247
  - doc/release_notes/1_1_4.md
248
+ - doc/release_notes/1_1_5.md
249
+ - doc/release_notes/1_2_0.md
246
250
  - lib/httpx.rb
247
251
  - lib/httpx/adapters/datadog.rb
248
252
  - lib/httpx/adapters/faraday.rb
@@ -277,6 +281,7 @@ files:
277
281
  - lib/httpx/plugins/aws_sigv4.rb
278
282
  - lib/httpx/plugins/basic_auth.rb
279
283
  - lib/httpx/plugins/brotli.rb
284
+ - lib/httpx/plugins/callbacks.rb
280
285
  - lib/httpx/plugins/circuit_breaker.rb
281
286
  - lib/httpx/plugins/circuit_breaker/circuit.rb
282
287
  - lib/httpx/plugins/circuit_breaker/circuit_store.rb
@@ -307,6 +312,7 @@ files:
307
312
  - lib/httpx/plugins/response_cache/file_store.rb
308
313
  - lib/httpx/plugins/response_cache/store.rb
309
314
  - lib/httpx/plugins/retries.rb
315
+ - lib/httpx/plugins/ssrf_filter.rb
310
316
  - lib/httpx/plugins/stream.rb
311
317
  - lib/httpx/plugins/upgrade.rb
312
318
  - lib/httpx/plugins/upgrade/h2.rb
@@ -348,6 +354,7 @@ files:
348
354
  - lib/httpx/transcoder/xml.rb
349
355
  - lib/httpx/utils.rb
350
356
  - lib/httpx/version.rb
357
+ - sig/altsvc.rbs
351
358
  - sig/buffer.rbs
352
359
  - sig/callbacks.rbs
353
360
  - sig/chainable.rbs
@@ -375,6 +382,7 @@ files:
375
382
  - sig/plugins/aws_sigv4.rbs
376
383
  - sig/plugins/basic_auth.rbs
377
384
  - sig/plugins/brotli.rbs
385
+ - sig/plugins/callbacks.rbs
378
386
  - sig/plugins/circuit_breaker.rbs
379
387
  - sig/plugins/compression.rbs
380
388
  - sig/plugins/cookies.rbs
@@ -435,8 +443,8 @@ licenses:
435
443
  - Apache 2.0
436
444
  metadata:
437
445
  bug_tracker_uri: https://gitlab.com/os85/httpx/issues
438
- changelog_uri: https://os85.gitlab.io/httpx/#release-notes
439
- documentation_uri: https://os85.gitlab.io/httpx/rdoc/
446
+ changelog_uri: https://honeyryderchuck.gitlab.io/httpx/#release-notes
447
+ documentation_uri: https://honeyryderchuck.gitlab.io/httpx/rdoc/
440
448
  source_code_uri: https://gitlab.com/os85/httpx
441
449
  homepage_uri: https://honeyryderchuck.gitlab.io/httpx/
442
450
  rubygems_mfa_required: 'true'