e621stream 0.0.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.
Files changed (77) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +21 -0
  3. data/README.md +35 -0
  4. data/lib/e621stream/client/options.rb +20 -0
  5. data/lib/e621stream/client.rb +211 -0
  6. data/lib/e621stream/close_codes.rb +23 -0
  7. data/lib/e621stream/event.rb +24 -0
  8. data/lib/e621stream/events.rb +29 -0
  9. data/lib/e621stream/stream_error.rb +18 -0
  10. data/lib/e621stream/version.rb +5 -0
  11. data/lib/e621stream.rb +18 -0
  12. data/sorbet/config +6 -0
  13. data/sorbet/rbi/annotations/.gitattributes +1 -0
  14. data/sorbet/rbi/annotations/minitest.rbi +120 -0
  15. data/sorbet/rbi/annotations/rainbow.rbi +269 -0
  16. data/sorbet/rbi/gems/.gitattributes +1 -0
  17. data/sorbet/rbi/gems/ast@2.4.3.rbi +550 -0
  18. data/sorbet/rbi/gems/async-http@0.105.0.rbi +1649 -0
  19. data/sorbet/rbi/gems/async-pool@0.12.0.rbi +219 -0
  20. data/sorbet/rbi/gems/async-websocket@0.30.2.rbi +271 -0
  21. data/sorbet/rbi/gems/async@2.46.0.rbi +2193 -0
  22. data/sorbet/rbi/gems/benchmark@0.5.0.rbi +495 -0
  23. data/sorbet/rbi/gems/console@1.38.0.rbi +1552 -0
  24. data/sorbet/rbi/gems/erb@6.0.7.rbi +1581 -0
  25. data/sorbet/rbi/gems/erubi@1.13.1.rbi +153 -0
  26. data/sorbet/rbi/gems/fiber-annotation@0.2.0.rbi +62 -0
  27. data/sorbet/rbi/gems/fiber-local@1.1.0.rbi +36 -0
  28. data/sorbet/rbi/gems/fiber-storage@1.0.1.rbi +43 -0
  29. data/sorbet/rbi/gems/io-console@0.9.5.rbi +9 -0
  30. data/sorbet/rbi/gems/io-endpoint@0.19.0.rbi +1079 -0
  31. data/sorbet/rbi/gems/io-event@1.22.3.rbi +971 -0
  32. data/sorbet/rbi/gems/io-stream@0.14.0.rbi +805 -0
  33. data/sorbet/rbi/gems/json@3.1.0.rbi +1929 -0
  34. data/sorbet/rbi/gems/language_server-protocol@3.17.0.6.rbi +9 -0
  35. data/sorbet/rbi/gems/lint_roller@1.1.0.rbi +189 -0
  36. data/sorbet/rbi/gems/logger@1.7.0.rbi +896 -0
  37. data/sorbet/rbi/gems/minitest@5.27.0.rbi +1499 -0
  38. data/sorbet/rbi/gems/netrc@0.11.0.rbi +147 -0
  39. data/sorbet/rbi/gems/openssl@4.0.2.rbi +4366 -0
  40. data/sorbet/rbi/gems/parallel@2.3.0.rbi +332 -0
  41. data/sorbet/rbi/gems/parser@3.3.13.0.rbi +5146 -0
  42. data/sorbet/rbi/gems/pp@0.6.4.rbi +373 -0
  43. data/sorbet/rbi/gems/prettyprint@0.2.1.rbi +476 -0
  44. data/sorbet/rbi/gems/prism@1.9.0.rbi +42213 -0
  45. data/sorbet/rbi/gems/protocol-hpack@1.5.1.rbi +418 -0
  46. data/sorbet/rbi/gems/protocol-http1@0.41.1.rbi +894 -0
  47. data/sorbet/rbi/gems/protocol-http2@0.29.2.rbi +2277 -0
  48. data/sorbet/rbi/gems/protocol-http@0.72.1.rbi +3801 -0
  49. data/sorbet/rbi/gems/protocol-rack@0.23.0.rbi +9 -0
  50. data/sorbet/rbi/gems/protocol-url@0.19.0.rbi +9 -0
  51. data/sorbet/rbi/gems/protocol-websocket@0.21.3.rbi +1087 -0
  52. data/sorbet/rbi/gems/racc@1.8.1.rbi +169 -0
  53. data/sorbet/rbi/gems/rack@3.2.8.rbi +9 -0
  54. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +362 -0
  55. data/sorbet/rbi/gems/rake@13.4.2.rbi +3127 -0
  56. data/sorbet/rbi/gems/rbi@0.5.0.rbi +5875 -0
  57. data/sorbet/rbi/gems/rbs@4.2.0.rbi +7133 -0
  58. data/sorbet/rbi/gems/rdoc@8.1.0.rbi +9 -0
  59. data/sorbet/rbi/gems/regexp_parser@2.13.1.rbi +3500 -0
  60. data/sorbet/rbi/gems/reline@0.7.0.rbi +2449 -0
  61. data/sorbet/rbi/gems/require-hooks@0.5.1.rbi +152 -0
  62. data/sorbet/rbi/gems/rexml@3.4.4.rbi +4905 -0
  63. data/sorbet/rbi/gems/rubocop-ast@1.51.0.rbi +7230 -0
  64. data/sorbet/rbi/gems/rubocop-rake@0.7.1.rbi +314 -0
  65. data/sorbet/rbi/gems/rubocop@1.92.2.rbi +69094 -0
  66. data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +988 -0
  67. data/sorbet/rbi/gems/rubydex@0.4.4.rbi +1620 -0
  68. data/sorbet/rbi/gems/spoom@1.8.13.rbi +7380 -0
  69. data/sorbet/rbi/gems/tapioca@0.20.0.rbi +3752 -0
  70. data/sorbet/rbi/gems/thor@1.5.0.rbi +3870 -0
  71. data/sorbet/rbi/gems/tsort@0.2.0.rbi +389 -0
  72. data/sorbet/rbi/gems/unicode-display_width@3.3.0.rbi +130 -0
  73. data/sorbet/rbi/gems/unicode-emoji@4.3.0.rbi +254 -0
  74. data/sorbet/rbi/gems/zeitwerk@2.8.3.rbi +1178 -0
  75. data/sorbet/tapioca/config.yml +13 -0
  76. data/sorbet/tapioca/require.rb +4 -0
  77. metadata +175 -0
@@ -0,0 +1,1649 @@
1
+ # typed: true
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This is an autogenerated file for types exported from the `async-http` gem.
5
+ # Please instead update this file by running `bin/tapioca gem async-http`.
6
+
7
+
8
+ # @namespace
9
+ # Released under the MIT License.
10
+ # Copyright, 2025-2026, by Samuel Williams.
11
+ # Released under the MIT License.
12
+ # Copyright, 2025, by Samuel Williams.
13
+ #
14
+ # pkg:gem/async-http#lib/async/http/protocol/defaulton.rb:6
15
+ module Async; end
16
+
17
+ # @namespace
18
+ #
19
+ # pkg:gem/async-http#lib/async/http/protocol/defaulton.rb:7
20
+ module Async::HTTP; end
21
+
22
+ # @namespace
23
+ #
24
+ # pkg:gem/async-http#lib/async/http/body/writable.rb:11
25
+ module Async::HTTP::Body; end
26
+
27
+ # pkg:gem/async-http#lib/async/http/body/writable.rb:12
28
+ Async::HTTP::Body::Writable = Protocol::HTTP::Body::Writable
29
+
30
+ # An HTTP client that manages persistent connections to a specific endpoint, with automatic retries for idempotent requests.
31
+ #
32
+ # pkg:gem/async-http#lib/async/http/client.rb:22
33
+ class Async::HTTP::Client < ::Protocol::HTTP::Methods
34
+ # Provides a robust interface to a server.
35
+ # * If there are no connections, it will create one.
36
+ # * If there are already connections, it will reuse it.
37
+ # * If a request fails, it will retry it up to N times if it was idempotent.
38
+ # The client object will never become unusable. It internally manages persistent connections (or non-persistent connections if that's required).
39
+ # @param endpoint [Endpoint] the endpoint to connnect to.
40
+ # @param protocol [Protocol::HTTP1 | Protocol::HTTP2 | Protocol::HTTPS] the protocol to use.
41
+ # @param scheme [String] The default scheme to set to requests.
42
+ # @param authority [String] The default authority to set to requests.
43
+ #
44
+ # pkg:gem/async-http#lib/async/http/client.rb:32
45
+ def initialize(endpoint, protocol: T.unsafe(nil), scheme: T.unsafe(nil), authority: T.unsafe(nil), retries: T.unsafe(nil), **options); end
46
+
47
+ # @returns [Hash] A JSON-compatible representation of this client.
48
+ #
49
+ # pkg:gem/async-http#lib/async/http/client.rb:44
50
+ def as_json(*, **, &); end
51
+
52
+ # pkg:gem/async-http#lib/async/http/client.rb:66
53
+ def authority; end
54
+
55
+ # Send a request to the remote server, with automatic retries for idempotent requests.
56
+ # @parameter request [Protocol::HTTP::Request] The request to send.
57
+ # @returns [Protocol::HTTP::Response] The response from the server.
58
+ #
59
+ # pkg:gem/async-http#lib/async/http/client.rb:100
60
+ def call(request); end
61
+
62
+ # Close the client and all associated connections.
63
+ #
64
+ # pkg:gem/async-http#lib/async/http/client.rb:89
65
+ def close; end
66
+
67
+ # pkg:gem/async-http#lib/async/http/client.rb:59
68
+ def endpoint; end
69
+
70
+ # @returns [String] A summary of this client.
71
+ #
72
+ # pkg:gem/async-http#lib/async/http/client.rb:149
73
+ def inspect; end
74
+
75
+ # pkg:gem/async-http#lib/async/http/client.rb:63
76
+ def pool; end
77
+
78
+ # pkg:gem/async-http#lib/async/http/client.rb:60
79
+ def protocol; end
80
+
81
+ # pkg:gem/async-http#lib/async/http/client.rb:62
82
+ def retries; end
83
+
84
+ # pkg:gem/async-http#lib/async/http/client.rb:65
85
+ def scheme; end
86
+
87
+ # @returns [Boolean] Whether the client uses a secure (TLS) connection.
88
+ #
89
+ # pkg:gem/async-http#lib/async/http/client.rb:69
90
+ def secure?; end
91
+
92
+ # @returns [String] A JSON string representation of this client.
93
+ #
94
+ # pkg:gem/async-http#lib/async/http/client.rb:55
95
+ def to_json(*, **, &); end
96
+
97
+ protected
98
+
99
+ # pkg:gem/async-http#lib/async/http/client.rb:163
100
+ def assign_default_tags(tags); end
101
+
102
+ # pkg:gem/async-http#lib/async/http/client.rb:168
103
+ def make_pool(**options); end
104
+
105
+ # pkg:gem/async-http#lib/async/http/client.rb:155
106
+ def make_response(request, connection, attempt); end
107
+
108
+ class << self
109
+ # Open a client and optionally yield it, ensuring it is closed afterwards.
110
+ # @parameter arguments [Array] Arguments to pass to {initialize}.
111
+ # @parameter options [Hash] Options to pass to {initialize}.
112
+ #
113
+ # pkg:gem/async-http#lib/async/http/client.rb:76
114
+ def open(*arguments, **options, &block); end
115
+ end
116
+ end
117
+
118
+ # pkg:gem/async-http#lib/async/http/client.rb:19
119
+ Async::HTTP::DEFAULT_RETRIES = T.let(T.unsafe(nil), Integer)
120
+
121
+ # Represents a way to connect to a remote HTTP server.
122
+ #
123
+ # pkg:gem/async-http#lib/async/http/endpoint.rb:23
124
+ class Async::HTTP::Endpoint < ::IO::Endpoint::Generic
125
+ # @option scheme [String] the scheme to use, overrides the URL scheme.
126
+ # @option hostname [String] the hostname to connect to (or bind to), overrides the URL hostname (used for SNI).
127
+ # @option port [Integer] the port to bind to, overrides the URL port.
128
+ # @option ssl_context [OpenSSL::SSL::SSLContext] the context to use for TLS.
129
+ # @option tls_configuration [IO::Endpoint::TLS::Configuration] the transport-neutral TLS configuration.
130
+ # @option alpn_protocols [Array(String)] the alpn protocols to negotiate.
131
+ #
132
+ # pkg:gem/async-http#lib/async/http/endpoint.rb:75
133
+ def initialize(url, endpoint = T.unsafe(nil), **options); end
134
+
135
+ # @returns [Addrinfo] The address of the underlying endpoint.
136
+ #
137
+ # pkg:gem/async-http#lib/async/http/endpoint.rb:113
138
+ def address; end
139
+
140
+ # @returns [Array(String)] The ALPN protocol names for TLS negotiation.
141
+ #
142
+ # pkg:gem/async-http#lib/async/http/endpoint.rb:179
143
+ def alpn_protocols; end
144
+
145
+ # @returns [String] The authority component (hostname and optional port).
146
+ #
147
+ # pkg:gem/async-http#lib/async/http/endpoint.rb:159
148
+ def authority(ignore_default_port = T.unsafe(nil)); end
149
+
150
+ # Bind to the endpoint.
151
+ #
152
+ # pkg:gem/async-http#lib/async/http/endpoint.rb:246
153
+ def bind(*arguments, &block); end
154
+
155
+ # Build a suitable endpoint, optionally wrapping in TLS for secure connections.
156
+ # @parameter endpoint [IO::Endpoint::Generic | Nil] An optional underlying endpoint to wrap.
157
+ # @returns [IO::Endpoint::Generic] The constructed endpoint.
158
+ #
159
+ # pkg:gem/async-http#lib/async/http/endpoint.rb:218
160
+ def build_endpoint(endpoint = T.unsafe(nil)); end
161
+
162
+ # Connect to the endpoint.
163
+ #
164
+ # pkg:gem/async-http#lib/async/http/endpoint.rb:251
165
+ def connect(&block); end
166
+
167
+ # @returns [Integer] The default port for this endpoint's scheme.
168
+ #
169
+ # pkg:gem/async-http#lib/async/http/endpoint.rb:134
170
+ def default_port; end
171
+
172
+ # @returns [Boolean] Whether the endpoint's port is the default for its scheme.
173
+ #
174
+ # pkg:gem/async-http#lib/async/http/endpoint.rb:139
175
+ def default_port?; end
176
+
177
+ # Enumerate all resolved endpoints.
178
+ # @yields {|endpoint| ...} Each resolved endpoint.
179
+ # @parameter endpoint [Endpoint] The resolved endpoint.
180
+ #
181
+ # pkg:gem/async-http#lib/async/http/endpoint.rb:258
182
+ def each; end
183
+
184
+ # @returns [IO::Endpoint::Generic] The resolved endpoint, built on demand.
185
+ #
186
+ # pkg:gem/async-http#lib/async/http/endpoint.rb:235
187
+ def endpoint; end
188
+
189
+ # Set the underlying endpoint, wrapping it as needed.
190
+ # @parameter endpoint [IO::Endpoint::Generic] The endpoint to assign.
191
+ #
192
+ # pkg:gem/async-http#lib/async/http/endpoint.rb:241
193
+ def endpoint=(endpoint); end
194
+
195
+ # @returns [Boolean] Whether two endpoints are equal.
196
+ #
197
+ # pkg:gem/async-http#lib/async/http/endpoint.rb:272
198
+ def eql?(other); end
199
+
200
+ # @returns [Integer] The hash code for this endpoint.
201
+ #
202
+ # pkg:gem/async-http#lib/async/http/endpoint.rb:277
203
+ def hash; end
204
+
205
+ # The hostname is the server we are connecting to:
206
+ #
207
+ # pkg:gem/async-http#lib/async/http/endpoint.rb:149
208
+ def hostname; end
209
+
210
+ # @returns [String] A detailed string representation of this endpoint.
211
+ #
212
+ # pkg:gem/async-http#lib/async/http/endpoint.rb:106
213
+ def inspect; end
214
+
215
+ # @returns [Array] A key suitable for identifying this endpoint in a hash.
216
+ #
217
+ # pkg:gem/async-http#lib/async/http/endpoint.rb:267
218
+ def key; end
219
+
220
+ # @returns [Boolean] Whether the endpoint refers to a localhost address.
221
+ #
222
+ # pkg:gem/async-http#lib/async/http/endpoint.rb:184
223
+ def localhost?; end
224
+
225
+ # Return the path and query components of the given URL.
226
+ #
227
+ # pkg:gem/async-http#lib/async/http/endpoint.rb:168
228
+ def path; end
229
+
230
+ # @returns [Integer] The port number for this endpoint.
231
+ #
232
+ # pkg:gem/async-http#lib/async/http/endpoint.rb:144
233
+ def port; end
234
+
235
+ # @returns [Protocol] The protocol to use for this endpoint.
236
+ #
237
+ # pkg:gem/async-http#lib/async/http/endpoint.rb:123
238
+ def protocol; end
239
+
240
+ # @returns [String] The URL scheme, e.g. `"http"` or `"https"`.
241
+ #
242
+ # pkg:gem/async-http#lib/async/http/endpoint.rb:154
243
+ def scheme; end
244
+
245
+ # @returns [Boolean] Whether this endpoint uses a secure protocol (HTTPS or WSS).
246
+ #
247
+ # pkg:gem/async-http#lib/async/http/endpoint.rb:118
248
+ def secure?; end
249
+
250
+ # @returns [OpenSSL::SSL::SSLContext] The SSL context for TLS connections.
251
+ #
252
+ # pkg:gem/async-http#lib/async/http/endpoint.rb:198
253
+ def ssl_context; end
254
+
255
+ # We don't try to validate peer certificates when talking to localhost because they would always be self-signed.
256
+ #
257
+ # pkg:gem/async-http#lib/async/http/endpoint.rb:189
258
+ def ssl_verify_mode; end
259
+
260
+ # @returns [IO::Endpoint::TLS::Configuration | Nil] The transport-neutral TLS configuration.
261
+ #
262
+ # pkg:gem/async-http#lib/async/http/endpoint.rb:211
263
+ def tls_configuration; end
264
+
265
+ # @returns [String] A short string representation of this endpoint.
266
+ #
267
+ # pkg:gem/async-http#lib/async/http/endpoint.rb:101
268
+ def to_s; end
269
+
270
+ # @returns [URI] The URL representation of this endpoint, including port if non-default.
271
+ #
272
+ # pkg:gem/async-http#lib/async/http/endpoint.rb:90
273
+ def to_url; end
274
+
275
+ # pkg:gem/async-http#lib/async/http/endpoint.rb:110
276
+ def url; end
277
+
278
+ protected
279
+
280
+ # pkg:gem/async-http#lib/async/http/endpoint.rb:297
281
+ def tcp_endpoint; end
282
+
283
+ # pkg:gem/async-http#lib/async/http/endpoint.rb:283
284
+ def tcp_options; end
285
+
286
+ class << self
287
+ # Coerce the given object into an endpoint.
288
+ # @parameter url [String | Endpoint] The URL or endpoint to convert.
289
+ #
290
+ # pkg:gem/async-http#lib/async/http/endpoint.rb:61
291
+ def [](url); end
292
+
293
+ # Construct an endpoint with a specified scheme, hostname, optional path, and options.
294
+ #
295
+ # @parameter scheme [String] The scheme to use, e.g. "http" or "https".
296
+ # @parameter hostname [String] The hostname to connect to (or bind to).
297
+ # @parameter *options [Hash] Additional options, passed to {initialize}.
298
+ #
299
+ # pkg:gem/async-http#lib/async/http/endpoint.rb:47
300
+ def for(scheme, hostname, path = T.unsafe(nil), **options); end
301
+
302
+ # Parse a URL string into an endpoint.
303
+ # @parameter string [String] The URL to parse.
304
+ # @parameter endpoint [IO::Endpoint::Generic | Nil] An optional underlying endpoint to use.
305
+ # @parameter options [Hash] Additional options to pass to {initialize}.
306
+ # @returns [Endpoint] The parsed endpoint.
307
+ #
308
+ # pkg:gem/async-http#lib/async/http/endpoint.rb:36
309
+ def parse(string, endpoint = T.unsafe(nil), **options); end
310
+ end
311
+ end
312
+
313
+ # pkg:gem/async-http#lib/async/http/endpoint.rb:24
314
+ Async::HTTP::Endpoint::SCHEMES = T.let(T.unsafe(nil), Hash)
315
+
316
+ # A protocol specifies a way in which to communicate with a remote peer.
317
+ #
318
+ # pkg:gem/async-http#lib/async/http/protocol/defaulton.rb:8
319
+ module Async::HTTP::Protocol; end
320
+
321
+ # Provides a `new` method that creates a {Configured} wrapper, allowing protocols to be instantiated with custom options.
322
+ #
323
+ # pkg:gem/async-http#lib/async/http/protocol/configurable.rb:48
324
+ module Async::HTTP::Protocol::Configurable
325
+ # Create a new {Configured} instance wrapping this protocol with the given options.
326
+ # @parameter options [Hash] Configuration options for client and server creation.
327
+ # @returns [Configured] A configured protocol instance.
328
+ #
329
+ # pkg:gem/async-http#lib/async/http/protocol/configurable.rb:52
330
+ def new(**options); end
331
+ end
332
+
333
+ # A protocol wrapper that forwards pre-configured options to client and server creation.
334
+ #
335
+ # pkg:gem/async-http#lib/async/http/protocol/configurable.rb:10
336
+ class Async::HTTP::Protocol::Configured
337
+ # Initialize with a protocol and options.
338
+ # @parameter protocol [Protocol] The underlying protocol to configure.
339
+ # @parameter options [Hash] Options to forward to client and server creation.
340
+ #
341
+ # pkg:gem/async-http#lib/async/http/protocol/configurable.rb:14
342
+ def initialize(protocol, **options); end
343
+
344
+ # Create a client connection using the configured protocol options.
345
+ # @parameter peer [IO] The peer to communicate with.
346
+ # @parameter options [Hash] Additional options merged with the configured defaults.
347
+ #
348
+ # pkg:gem/async-http#lib/async/http/protocol/configurable.rb:28
349
+ def client(peer, **options); end
350
+
351
+ # @returns [Array(String)] The protocol names from the underlying protocol.
352
+ #
353
+ # pkg:gem/async-http#lib/async/http/protocol/configurable.rb:42
354
+ def names; end
355
+
356
+ # @attribute [Hash] The options to pass to the protocol.
357
+ #
358
+ # pkg:gem/async-http#lib/async/http/protocol/configurable.rb:23
359
+ def options; end
360
+
361
+ # @attribute [Protocol] The underlying protocol.
362
+ #
363
+ # pkg:gem/async-http#lib/async/http/protocol/configurable.rb:20
364
+ def protocol; end
365
+
366
+ # Create a server connection using the configured protocol options.
367
+ # @parameter peer [IO] The peer to communicate with.
368
+ # @parameter options [Hash] Additional options merged with the configured defaults.
369
+ #
370
+ # pkg:gem/async-http#lib/async/http/protocol/configurable.rb:36
371
+ def server(peer, **options); end
372
+ end
373
+
374
+ # This module provides a default instance of the protocol, which can be used to create clients and servers. The name is a play on "Default" + "Singleton".
375
+ #
376
+ # pkg:gem/async-http#lib/async/http/protocol/defaulton.rb:10
377
+ module Async::HTTP::Protocol::Defaulton
378
+ # Create a client for an outbound connection, using the default instance.
379
+ #
380
+ # pkg:gem/async-http#lib/async/http/protocol/defaulton.rb:18
381
+ def client(peer, **options); end
382
+
383
+ # pkg:gem/async-http#lib/async/http/protocol/defaulton.rb:15
384
+ def default; end
385
+
386
+ # pkg:gem/async-http#lib/async/http/protocol/defaulton.rb:15
387
+ def default=(_arg0); end
388
+
389
+ # @returns [Array] The names of the supported protocol, used for Application Layer Protocol Negotiation (ALPN), using the default instance.
390
+ #
391
+ # pkg:gem/async-http#lib/async/http/protocol/defaulton.rb:28
392
+ def names; end
393
+
394
+ # Create a server for an inbound connection, using the default instance.
395
+ #
396
+ # pkg:gem/async-http#lib/async/http/protocol/defaulton.rb:23
397
+ def server(peer, **options); end
398
+
399
+ class << self
400
+ # pkg:gem/async-http#lib/async/http/protocol/defaulton.rb:11
401
+ def extended(base); end
402
+ end
403
+ end
404
+
405
+ # HTTP is an http:// server that auto-selects HTTP/1.1 or HTTP/2 by detecting the HTTP/2 connection preface.
406
+ #
407
+ # pkg:gem/async-http#lib/async/http/protocol/http.rb:16
408
+ class Async::HTTP::Protocol::HTTP
409
+ extend ::Async::HTTP::Protocol::Defaulton
410
+
411
+ # Create a new HTTP protocol instance.
412
+ #
413
+ # @parameter http1 [HTTP1] The HTTP/1 protocol instance.
414
+ # @parameter http2 [HTTP2] The HTTP/2 protocol instance.
415
+ #
416
+ # pkg:gem/async-http#lib/async/http/protocol/http.rb:24
417
+ def initialize(http1: T.unsafe(nil), http2: T.unsafe(nil)); end
418
+
419
+ # Create a client for an outbound connection. Defaults to HTTP/1 for plaintext connections.
420
+ #
421
+ # @parameter peer [IO] The peer to communicate with.
422
+ # @parameter options [Hash] Options to pass to the protocol, keyed by protocol class.
423
+ #
424
+ # pkg:gem/async-http#lib/async/http/protocol/http.rb:62
425
+ def client(peer, **options); end
426
+
427
+ # The names of all supported protocols.
428
+ # @returns [Array(String)] The supported protocol names.
429
+ #
430
+ # pkg:gem/async-http#lib/async/http/protocol/http.rb:31
431
+ def names; end
432
+
433
+ # Determine if the inbound connection is HTTP/1 or HTTP/2.
434
+ #
435
+ # @parameter stream [IO::Stream] The stream to detect the protocol for.
436
+ # @returns [Class] The protocol class to use.
437
+ #
438
+ # pkg:gem/async-http#lib/async/http/protocol/http.rb:39
439
+ def protocol_for(stream); end
440
+
441
+ # Create a server for an inbound connection. Able to detect HTTP1 and HTTP2.
442
+ #
443
+ # @parameter peer [IO] The peer to communicate with.
444
+ # @parameter options [Hash] Options to pass to the protocol, keyed by protocol class.
445
+ #
446
+ # pkg:gem/async-http#lib/async/http/protocol/http.rb:72
447
+ def server(peer, **options); end
448
+ end
449
+
450
+ # Provides HTTP/1.0 and HTTP/1.1 client and server implementations.
451
+ #
452
+ # pkg:gem/async-http#lib/async/http/protocol/http1/request.rb:11
453
+ module Async::HTTP::Protocol::HTTP1
454
+ extend ::Async::HTTP::Protocol::Configurable
455
+
456
+ class << self
457
+ # @returns [Boolean] Whether the protocol supports bidirectional communication.
458
+ #
459
+ # pkg:gem/async-http#lib/async/http/protocol/http1.rb:24
460
+ def bidirectional?; end
461
+
462
+ # Create a client for an outbound connection.
463
+ #
464
+ # @parameter peer [IO] The peer to communicate with.
465
+ # @parameter options [Hash] Options to pass to the client instance.
466
+ #
467
+ # pkg:gem/async-http#lib/async/http/protocol/http1.rb:37
468
+ def client(peer, **options); end
469
+
470
+ # @returns [Array] The names of the supported protocol.
471
+ #
472
+ # pkg:gem/async-http#lib/async/http/protocol/http1.rb:54
473
+ def names; end
474
+
475
+ # Create a server for an inbound connection.
476
+ #
477
+ # @parameter peer [IO] The peer to communicate with.
478
+ # @parameter options [Hash] Options to pass to the server instance.
479
+ #
480
+ # pkg:gem/async-http#lib/async/http/protocol/http1.rb:47
481
+ def server(peer, **options); end
482
+
483
+ # @returns [Boolean] Whether the protocol supports trailers.
484
+ #
485
+ # pkg:gem/async-http#lib/async/http/protocol/http1.rb:29
486
+ def trailer?; end
487
+ end
488
+ end
489
+
490
+ # Provides an HTTP/1.0 client and server protocol implementation.
491
+ #
492
+ # pkg:gem/async-http#lib/async/http/protocol/http10.rb:13
493
+ module Async::HTTP::Protocol::HTTP10
494
+ extend ::Async::HTTP::Protocol::Configurable
495
+
496
+ class << self
497
+ # @returns [Boolean] Whether the protocol supports bidirectional communication.
498
+ #
499
+ # pkg:gem/async-http#lib/async/http/protocol/http10.rb:19
500
+ def bidirectional?; end
501
+
502
+ # Create a client for an outbound connection.
503
+ #
504
+ # @parameter peer [IO] The peer to communicate with.
505
+ # @parameter options [Hash] Options to pass to the client instance.
506
+ #
507
+ # pkg:gem/async-http#lib/async/http/protocol/http10.rb:32
508
+ def client(peer, **options); end
509
+
510
+ # @returns [Array] The names of the supported protocol.
511
+ #
512
+ # pkg:gem/async-http#lib/async/http/protocol/http10.rb:49
513
+ def names; end
514
+
515
+ # Create a server for an inbound connection.
516
+ #
517
+ # @parameter peer [IO] The peer to communicate with.
518
+ # @parameter options [Hash] Options to pass to the server instance.
519
+ #
520
+ # pkg:gem/async-http#lib/async/http/protocol/http10.rb:42
521
+ def server(peer, **options); end
522
+
523
+ # @returns [Boolean] Whether the protocol supports trailers.
524
+ #
525
+ # pkg:gem/async-http#lib/async/http/protocol/http10.rb:24
526
+ def trailer?; end
527
+ end
528
+ end
529
+
530
+ # pkg:gem/async-http#lib/async/http/protocol/http10.rb:16
531
+ Async::HTTP::Protocol::HTTP10::VERSION = T.let(T.unsafe(nil), String)
532
+
533
+ # Provides an HTTP/1.1 client and server protocol implementation.
534
+ #
535
+ # pkg:gem/async-http#lib/async/http/protocol/http11.rb:14
536
+ module Async::HTTP::Protocol::HTTP11
537
+ extend ::Async::HTTP::Protocol::Configurable
538
+
539
+ class << self
540
+ # @returns [Boolean] Whether the protocol supports bidirectional communication.
541
+ #
542
+ # pkg:gem/async-http#lib/async/http/protocol/http11.rb:20
543
+ def bidirectional?; end
544
+
545
+ # Create a client for an outbound connection.
546
+ #
547
+ # @parameter peer [IO] The peer to communicate with.
548
+ # @parameter options [Hash] Options to pass to the client instance.
549
+ #
550
+ # pkg:gem/async-http#lib/async/http/protocol/http11.rb:33
551
+ def client(peer, **options); end
552
+
553
+ # @returns [Array] The names of the supported protocol.
554
+ #
555
+ # pkg:gem/async-http#lib/async/http/protocol/http11.rb:50
556
+ def names; end
557
+
558
+ # Create a server for an inbound connection.
559
+ #
560
+ # @parameter peer [IO] The peer to communicate with.
561
+ # @parameter options [Hash] Options to pass to the server instance.
562
+ #
563
+ # pkg:gem/async-http#lib/async/http/protocol/http11.rb:43
564
+ def server(peer, **options); end
565
+
566
+ # @returns [Boolean] Whether the protocol supports trailers.
567
+ #
568
+ # pkg:gem/async-http#lib/async/http/protocol/http11.rb:25
569
+ def trailer?; end
570
+ end
571
+ end
572
+
573
+ # pkg:gem/async-http#lib/async/http/protocol/http11.rb:17
574
+ Async::HTTP::Protocol::HTTP11::VERSION = T.let(T.unsafe(nil), String)
575
+
576
+ # An HTTP/1 client connection that sends requests and reads responses.
577
+ #
578
+ # pkg:gem/async-http#lib/async/http/protocol/http1/client.rb:13
579
+ class Async::HTTP::Protocol::HTTP1::Client < ::Async::HTTP::Protocol::HTTP1::Connection
580
+ # Initialize the HTTP/1 client connection.
581
+ #
582
+ # pkg:gem/async-http#lib/async/http/protocol/http1/client.rb:15
583
+ def initialize(*, **, &); end
584
+
585
+ # Used by the client to send requests to the remote server.
586
+ #
587
+ # pkg:gem/async-http#lib/async/http/protocol/http1/client.rb:35
588
+ def call(request, task: T.unsafe(nil)); end
589
+
590
+ # Called when the connection is closed, releasing it back to the pool.
591
+ #
592
+ # pkg:gem/async-http#lib/async/http/protocol/http1/client.rb:24
593
+ def closed(error = T.unsafe(nil)); end
594
+
595
+ # pkg:gem/async-http#lib/async/http/protocol/http1/client.rb:21
596
+ def pool; end
597
+
598
+ # pkg:gem/async-http#lib/async/http/protocol/http1/client.rb:21
599
+ def pool=(_arg0); end
600
+ end
601
+
602
+ # An HTTP/1 connection that wraps an IO stream with version and state tracking.
603
+ #
604
+ # pkg:gem/async-http#lib/async/http/protocol/http1/connection.rb:17
605
+ class Async::HTTP::Protocol::HTTP1::Connection < ::Protocol::HTTP1::Connection
606
+ # Initialize the connection with an IO stream and HTTP version.
607
+ # @parameter stream [IO::Stream] The underlying stream.
608
+ # @parameter version [String] The negotiated HTTP version string.
609
+ # @parameter options [Hash] Additional options for the connection.
610
+ #
611
+ # pkg:gem/async-http#lib/async/http/protocol/http1/connection.rb:22
612
+ def initialize(stream, version, **options); end
613
+
614
+ # @returns [String] A JSON-compatible representation.
615
+ #
616
+ # pkg:gem/async-http#lib/async/http/protocol/http1/connection.rb:35
617
+ def as_json(*, **, &); end
618
+
619
+ # @returns [Integer] The maximum number of concurrent requests (always 1 for HTTP/1).
620
+ #
621
+ # pkg:gem/async-http#lib/async/http/protocol/http1/connection.rb:64
622
+ def concurrency; end
623
+
624
+ # pkg:gem/async-http#lib/async/http/protocol/http1/connection.rb:61
625
+ def count; end
626
+
627
+ # @returns [Boolean] Whether this is an HTTP/1 connection.
628
+ #
629
+ # pkg:gem/async-http#lib/async/http/protocol/http1/connection.rb:47
630
+ def http1?; end
631
+
632
+ # @returns [Boolean] Whether this is an HTTP/2 connection.
633
+ #
634
+ # pkg:gem/async-http#lib/async/http/protocol/http1/connection.rb:52
635
+ def http2?; end
636
+
637
+ # @returns [Protocol::HTTP::Peer] The peer information for this connection.
638
+ #
639
+ # pkg:gem/async-http#lib/async/http/protocol/http1/connection.rb:57
640
+ def peer; end
641
+
642
+ # @returns [Boolean] Whether the connection can be reused for another request.
643
+ #
644
+ # pkg:gem/async-http#lib/async/http/protocol/http1/connection.rb:91
645
+ def reusable?; end
646
+
647
+ # @returns [String] A JSON string representation.
648
+ #
649
+ # pkg:gem/async-http#lib/async/http/protocol/http1/connection.rb:40
650
+ def to_json(*, **, &); end
651
+
652
+ # @returns [String] A string representation of this connection.
653
+ #
654
+ # pkg:gem/async-http#lib/async/http/protocol/http1/connection.rb:30
655
+ def to_s; end
656
+
657
+ # pkg:gem/async-http#lib/async/http/protocol/http1/connection.rb:44
658
+ def version; end
659
+
660
+ # Can we use this connection to make requests?
661
+ #
662
+ # pkg:gem/async-http#lib/async/http/protocol/http1/connection.rb:69
663
+ def viable?; end
664
+ end
665
+
666
+ # Keeps track of whether a body is being read, and if so, waits for it to be closed.
667
+ #
668
+ # pkg:gem/async-http#lib/async/http/protocol/http1/finishable.rb:15
669
+ class Async::HTTP::Protocol::HTTP1::Finishable < ::Protocol::HTTP::Body::Wrapper
670
+ # Initialize the finishable wrapper.
671
+ # @parameter body [Protocol::HTTP::Body::Readable] The body to wrap.
672
+ #
673
+ # pkg:gem/async-http#lib/async/http/protocol/http1/finishable.rb:18
674
+ def initialize(body); end
675
+
676
+ # Close the body and signal any waiting tasks.
677
+ #
678
+ # pkg:gem/async-http#lib/async/http/protocol/http1/finishable.rb:41
679
+ def close(error = T.unsafe(nil)); end
680
+
681
+ # @returns [String] A detailed representation of this finishable body.
682
+ #
683
+ # pkg:gem/async-http#lib/async/http/protocol/http1/finishable.rb:65
684
+ def inspect; end
685
+
686
+ # Read the next chunk from the body.
687
+ # @returns [String | Nil] The next chunk of data.
688
+ #
689
+ # pkg:gem/async-http#lib/async/http/protocol/http1/finishable.rb:34
690
+ def read; end
691
+
692
+ # @returns [Boolean] Whether the body has started reading.
693
+ #
694
+ # pkg:gem/async-http#lib/async/http/protocol/http1/finishable.rb:28
695
+ def reading?; end
696
+
697
+ # Wait for the body to be fully consumed or discard it.
698
+ # @parameter persistent [Boolean] Whether the connection will be reused.
699
+ #
700
+ # pkg:gem/async-http#lib/async/http/protocol/http1/finishable.rb:52
701
+ def wait(persistent = T.unsafe(nil)); end
702
+ end
703
+
704
+ # An incoming HTTP/1 request parsed from the connection.
705
+ #
706
+ # pkg:gem/async-http#lib/async/http/protocol/http1/request.rb:13
707
+ class Async::HTTP::Protocol::HTTP1::Request < ::Async::HTTP::Protocol::Request
708
+ # Initialize the request from the parsed components.
709
+ # @parameter connection [Connection] The underlying connection.
710
+ # @parameter scheme [String | Nil] The request scheme.
711
+ # @parameter authority [String | Nil] The request authority.
712
+ # @parameter method [String] The HTTP method.
713
+ # @parameter path [String | Nil] The request path.
714
+ # @parameter version [String] The HTTP version.
715
+ # @parameter headers [Protocol::HTTP::Headers] The request headers.
716
+ # @parameter body [Protocol::HTTP::Body::Readable | Nil] The request body.
717
+ #
718
+ # pkg:gem/async-http#lib/async/http/protocol/http1/request.rb:61
719
+ def initialize(connection, scheme, authority, method, path, version, headers, body); end
720
+
721
+ # @returns [Connection] The underlying HTTP/1 connection.
722
+ #
723
+ # pkg:gem/async-http#lib/async/http/protocol/http1/request.rb:71
724
+ def connection; end
725
+
726
+ # Hijack the underlying connection for bidirectional communication.
727
+ #
728
+ # pkg:gem/async-http#lib/async/http/protocol/http1/request.rb:81
729
+ def hijack!; end
730
+
731
+ # @returns [Boolean] Whether connection hijacking is supported.
732
+ #
733
+ # pkg:gem/async-http#lib/async/http/protocol/http1/request.rb:76
734
+ def hijack?; end
735
+
736
+ # Write an interim (1xx) response to the client.
737
+ # @parameter status [Integer] The interim HTTP status code.
738
+ # @parameter headers [Hash | Nil] Optional interim response headers.
739
+ #
740
+ # pkg:gem/async-http#lib/async/http/protocol/http1/request.rb:88
741
+ def write_interim_response(status, headers = T.unsafe(nil)); end
742
+
743
+ class << self
744
+ # Read and parse the next request from the connection.
745
+ # @parameter connection [Connection] The HTTP/1 connection to read from.
746
+ # @returns [Request | Nil] The parsed request, or `nil` if the connection is closed.
747
+ #
748
+ # pkg:gem/async-http#lib/async/http/protocol/http1/request.rb:32
749
+ def read(connection); end
750
+
751
+ # Check whether the given request target is a valid path.
752
+ # @parameter target [String] The request target to validate.
753
+ # @returns [Boolean] Whether the target is a valid path.
754
+ #
755
+ # pkg:gem/async-http#lib/async/http/protocol/http1/request.rb:17
756
+ def valid_path?(target); end
757
+ end
758
+ end
759
+
760
+ # pkg:gem/async-http#lib/async/http/protocol/http1/request.rb:50
761
+ Async::HTTP::Protocol::HTTP1::Request::UPGRADE = T.let(T.unsafe(nil), String)
762
+
763
+ # pkg:gem/async-http#lib/async/http/protocol/http1/request.rb:27
764
+ Async::HTTP::Protocol::HTTP1::Request::URI_PATTERN = T.let(T.unsafe(nil), Regexp)
765
+
766
+ # An HTTP/1 response received from a server.
767
+ #
768
+ # pkg:gem/async-http#lib/async/http/protocol/http1/response.rb:14
769
+ class Async::HTTP::Protocol::HTTP1::Response < ::Async::HTTP::Protocol::Response
770
+ # @parameter reason [String] HTTP response line reason phrase.
771
+ #
772
+ # pkg:gem/async-http#lib/async/http/protocol/http1/response.rb:37
773
+ def initialize(connection, version, status, reason, headers, body); end
774
+
775
+ # @returns [Connection] The underlying HTTP/1 connection.
776
+ #
777
+ # pkg:gem/async-http#lib/async/http/protocol/http1/response.rb:58
778
+ def connection; end
779
+
780
+ # Hijack the underlying connection for bidirectional communication.
781
+ #
782
+ # pkg:gem/async-http#lib/async/http/protocol/http1/response.rb:68
783
+ def hijack!; end
784
+
785
+ # @returns [Boolean] Whether connection hijacking is available (when the body is `nil`).
786
+ #
787
+ # pkg:gem/async-http#lib/async/http/protocol/http1/response.rb:63
788
+ def hijack?; end
789
+
790
+ # Assign the connection pool, releasing the connection if it is already idle or closed.
791
+ # @parameter pool [Async::Pool::Controller] The connection pool.
792
+ #
793
+ # pkg:gem/async-http#lib/async/http/protocol/http1/response.rb:49
794
+ def pool=(pool); end
795
+
796
+ # @attribute [String] The HTTP response line reason.
797
+ #
798
+ # pkg:gem/async-http#lib/async/http/protocol/http1/response.rb:34
799
+ def reason; end
800
+
801
+ class << self
802
+ # Read the response from the connection, handling interim responses.
803
+ # @parameter connection [Connection] The HTTP/1 connection to read from.
804
+ # @parameter request [Request] The original request.
805
+ # @returns [Response | Nil] The final response.
806
+ #
807
+ # pkg:gem/async-http#lib/async/http/protocol/http1/response.rb:19
808
+ def read(connection, request); end
809
+ end
810
+ end
811
+
812
+ # pkg:gem/async-http#lib/async/http/protocol/http1/response.rb:31
813
+ Async::HTTP::Protocol::HTTP1::Response::UPGRADE = T.let(T.unsafe(nil), String)
814
+
815
+ # An HTTP/1 server connection that receives requests and sends responses.
816
+ #
817
+ # pkg:gem/async-http#lib/async/http/protocol/http1/server.rb:22
818
+ class Async::HTTP::Protocol::HTTP1::Server < ::Async::HTTP::Protocol::HTTP1::Connection
819
+ # Initialize the HTTP/1 server connection.
820
+ #
821
+ # pkg:gem/async-http#lib/async/http/protocol/http1/server.rb:24
822
+ def initialize(*, **, &); end
823
+
824
+ # Called when the connection is closed, signalling any waiting tasks.
825
+ #
826
+ # pkg:gem/async-http#lib/async/http/protocol/http1/server.rb:31
827
+ def closed(error = T.unsafe(nil)); end
828
+
829
+ # Server loop.
830
+ #
831
+ # pkg:gem/async-http#lib/async/http/protocol/http1/server.rb:75
832
+ def each(task: T.unsafe(nil)); end
833
+
834
+ # Write a failure response with the given status code and error class name.
835
+ # @parameter status [Integer] The HTTP status code to send.
836
+ # @parameter error [Exception] The error which caused the request to fail.
837
+ #
838
+ # pkg:gem/async-http#lib/async/http/protocol/http1/server.rb:40
839
+ def fail_request(status, error); end
840
+
841
+ # Read the next incoming request from the connection.
842
+ # @returns [Request | Nil] The next request, or `nil` if the connection is closed.
843
+ #
844
+ # pkg:gem/async-http#lib/async/http/protocol/http1/server.rb:53
845
+ def next_request; end
846
+ end
847
+
848
+ # pkg:gem/async-http#lib/async/http/protocol/http1.rb:21
849
+ Async::HTTP::Protocol::HTTP1::VERSION = T.let(T.unsafe(nil), String)
850
+
851
+ # Provides an HTTP/2 client and server protocol implementation.
852
+ #
853
+ # pkg:gem/async-http#lib/async/http/protocol/http2/input.rb:11
854
+ module Async::HTTP::Protocol::HTTP2
855
+ extend ::Async::HTTP::Protocol::Configurable
856
+
857
+ class << self
858
+ # @returns [Boolean] Whether the protocol supports bidirectional communication.
859
+ #
860
+ # pkg:gem/async-http#lib/async/http/protocol/http2.rb:24
861
+ def bidirectional?; end
862
+
863
+ # Create a client for an outbound connection.
864
+ #
865
+ # @parameter peer [IO] The peer to communicate with.
866
+ # @parameter options [Hash] Options to pass to the client instance.
867
+ #
868
+ # pkg:gem/async-http#lib/async/http/protocol/http2.rb:55
869
+ def client(peer, settings: T.unsafe(nil)); end
870
+
871
+ # @returns [Array] The names of the supported protocol.
872
+ #
873
+ # pkg:gem/async-http#lib/async/http/protocol/http2.rb:80
874
+ def names; end
875
+
876
+ # Create a server for an inbound connection.
877
+ #
878
+ # @parameter peer [IO] The peer to communicate with.
879
+ # @parameter options [Hash] Options to pass to the server instance.
880
+ #
881
+ # pkg:gem/async-http#lib/async/http/protocol/http2.rb:69
882
+ def server(peer, settings: T.unsafe(nil)); end
883
+
884
+ # @returns [Boolean] Whether the protocol supports trailers.
885
+ #
886
+ # pkg:gem/async-http#lib/async/http/protocol/http2.rb:29
887
+ def trailer?; end
888
+ end
889
+ end
890
+
891
+ # pkg:gem/async-http#lib/async/http/protocol/http2/connection.rb:22
892
+ Async::HTTP::Protocol::HTTP2::AUTHORITY = T.let(T.unsafe(nil), String)
893
+
894
+ # The default settings for the client.
895
+ #
896
+ # pkg:gem/async-http#lib/async/http/protocol/http2.rb:34
897
+ Async::HTTP::Protocol::HTTP2::CLIENT_SETTINGS = T.let(T.unsafe(nil), Hash)
898
+
899
+ # pkg:gem/async-http#lib/async/http/protocol/http2/connection.rb:27
900
+ Async::HTTP::Protocol::HTTP2::CONNECTION = T.let(T.unsafe(nil), String)
901
+
902
+ # pkg:gem/async-http#lib/async/http/protocol/http2/connection.rb:26
903
+ Async::HTTP::Protocol::HTTP2::CONTENT_LENGTH = T.let(T.unsafe(nil), String)
904
+
905
+ # An HTTP/2 client connection that sends requests and reads responses.
906
+ #
907
+ # pkg:gem/async-http#lib/async/http/protocol/http2/client.rb:17
908
+ class Async::HTTP::Protocol::HTTP2::Client < ::Protocol::HTTP2::Client
909
+ include ::Async::HTTP::Protocol::HTTP2::Connection
910
+
911
+ # Initialize the HTTP/2 client with an IO stream.
912
+ # @parameter stream [IO::Stream] The underlying stream.
913
+ #
914
+ # pkg:gem/async-http#lib/async/http/protocol/http2/client.rb:22
915
+ def initialize(stream); end
916
+
917
+ # Used by the client to send requests to the remote server.
918
+ #
919
+ # pkg:gem/async-http#lib/async/http/protocol/http2/client.rb:37
920
+ def call(request); end
921
+
922
+ # Create a new response stream for the next request.
923
+ # @returns [Response] The response object to be populated.
924
+ #
925
+ # pkg:gem/async-http#lib/async/http/protocol/http2/client.rb:32
926
+ def create_response; end
927
+
928
+ # Wait for the response headers to arrive.
929
+ # @parameter response [Response] The response to wait on.
930
+ #
931
+ # pkg:gem/async-http#lib/async/http/protocol/http2/client.rb:60
932
+ def read_response(response); end
933
+
934
+ # Write a request to the remote server via the given response stream.
935
+ # @parameter response [Response] The response stream to write through.
936
+ # @parameter request [Protocol::HTTP::Request] The request to send.
937
+ #
938
+ # pkg:gem/async-http#lib/async/http/protocol/http2/client.rb:54
939
+ def write_request(response, request); end
940
+ end
941
+
942
+ # Provides shared connection behaviour for HTTP/2 client and server connections.
943
+ #
944
+ # pkg:gem/async-http#lib/async/http/protocol/http2/connection.rb:31
945
+ module Async::HTTP::Protocol::HTTP2::Connection
946
+ # Initialize the connection state.
947
+ #
948
+ # pkg:gem/async-http#lib/async/http/protocol/http2/connection.rb:33
949
+ def initialize(*, **, &); end
950
+
951
+ # @returns [String] A JSON-compatible representation.
952
+ #
953
+ # pkg:gem/async-http#lib/async/http/protocol/http2/connection.rb:64
954
+ def as_json(*, **, &); end
955
+
956
+ # Close the connection and stop the background reader.
957
+ #
958
+ # pkg:gem/async-http#lib/async/http/protocol/http2/connection.rb:91
959
+ def close(error = T.unsafe(nil)); end
960
+
961
+ # The connection has finished draining the streams which the remote peer accepted before its graceful GOAWAY.
962
+ #
963
+ # The last of those streams can complete on the sending side, in a task other than the background reader - the response arrived first and the request body was still being written. The reader is then parked in a blocking read and will never notice that the connection is closed, so we stop it and let its `ensure` close the connection.
964
+ #
965
+ # pkg:gem/async-http#lib/async/http/protocol/http2/connection.rb:105
966
+ def close_if_drained!; end
967
+
968
+ # @returns [Integer] The maximum number of concurrent streams allowed.
969
+ #
970
+ # pkg:gem/async-http#lib/async/http/protocol/http2/connection.rb:151
971
+ def concurrency; end
972
+
973
+ # pkg:gem/async-http#lib/async/http/protocol/http2/connection.rb:148
974
+ def count; end
975
+
976
+ # @returns [Boolean] Whether this is an HTTP/1 connection.
977
+ #
978
+ # pkg:gem/async-http#lib/async/http/protocol/http2/connection.rb:76
979
+ def http1?; end
980
+
981
+ # @returns [Boolean] Whether this is an HTTP/2 connection.
982
+ #
983
+ # pkg:gem/async-http#lib/async/http/protocol/http2/connection.rb:81
984
+ def http2?; end
985
+
986
+ # @returns [Protocol::HTTP::Peer] The peer information for this connection.
987
+ #
988
+ # pkg:gem/async-http#lib/async/http/protocol/http2/connection.rb:144
989
+ def peer; end
990
+
991
+ # pkg:gem/async-http#lib/async/http/protocol/http2/connection.rb:141
992
+ def promises; end
993
+
994
+ # Start a transient background task that reads frames from the connection.
995
+ #
996
+ # pkg:gem/async-http#lib/async/http/protocol/http2/connection.rb:114
997
+ def read_in_background(parent: T.unsafe(nil)); end
998
+
999
+ # @returns [Boolean] Whether the connection can be reused.
1000
+ #
1001
+ # Once the remote peer has sent a GOAWAY frame, it will not process any new streams on this connection, so it must not be handed out for another request, even while the streams it accepted are still being drained.
1002
+ #
1003
+ # pkg:gem/async-http#lib/async/http/protocol/http2/connection.rb:163
1004
+ def reusable?; end
1005
+
1006
+ # Start the background reader task if it is not already running.
1007
+ #
1008
+ # pkg:gem/async-http#lib/async/http/protocol/http2/connection.rb:86
1009
+ def start_connection; end
1010
+
1011
+ # pkg:gem/async-http#lib/async/http/protocol/http2/connection.rb:73
1012
+ def stream; end
1013
+
1014
+ # Synchronize write access to the connection.
1015
+ # @yields {|...| ...} The block to execute while holding the write lock.
1016
+ #
1017
+ # pkg:gem/async-http#lib/async/http/protocol/http2/connection.rb:44
1018
+ def synchronize(&block); end
1019
+
1020
+ # @returns [String] A JSON string representation.
1021
+ #
1022
+ # pkg:gem/async-http#lib/async/http/protocol/http2/connection.rb:69
1023
+ def to_json(*, **, &); end
1024
+
1025
+ # @returns [String] A string representation of this connection.
1026
+ #
1027
+ # pkg:gem/async-http#lib/async/http/protocol/http2/connection.rb:59
1028
+ def to_s; end
1029
+
1030
+ # @returns [String] The HTTP version string.
1031
+ #
1032
+ # pkg:gem/async-http#lib/async/http/protocol/http2/connection.rb:168
1033
+ def version; end
1034
+
1035
+ # Can we use this connection to make requests?
1036
+ #
1037
+ # pkg:gem/async-http#lib/async/http/protocol/http2/connection.rb:156
1038
+ def viable?; end
1039
+
1040
+ # Write a single frame, deferring stop until the frame is written.
1041
+ #
1042
+ # pkg:gem/async-http#lib/async/http/protocol/http2/connection.rb:49
1043
+ def write_frame(frame); end
1044
+
1045
+ # Write multiple frames, deferring stop until the frames are written.
1046
+ #
1047
+ # pkg:gem/async-http#lib/async/http/protocol/http2/connection.rb:54
1048
+ def write_frames; end
1049
+ end
1050
+
1051
+ # pkg:gem/async-http#lib/async/http/protocol/http2/connection.rb:18
1052
+ Async::HTTP::Protocol::HTTP2::HTTPS = T.let(T.unsafe(nil), String)
1053
+
1054
+ # A writable body which requests window updates when data is read from it.
1055
+ #
1056
+ # pkg:gem/async-http#lib/async/http/protocol/http2/input.rb:13
1057
+ class Async::HTTP::Protocol::HTTP2::Input < ::Protocol::HTTP::Body::Writable
1058
+ # Initialize the input body.
1059
+ # @parameter stream [Stream] The HTTP/2 stream to read from.
1060
+ # @parameter length [Integer | Nil] The expected content length.
1061
+ #
1062
+ # pkg:gem/async-http#lib/async/http/protocol/http2/input.rb:17
1063
+ def initialize(stream, length); end
1064
+
1065
+ # Close the application-facing input body and notify the stream that incoming data is no longer being consumed. While local output is active, the HTTP/2 stream remains open. Once output also closes, the remaining wire stream is terminated without an error.
1066
+ # @parameter error [Exception | Nil] The error that caused the input to be closed, if any.
1067
+ #
1068
+ # pkg:gem/async-http#lib/async/http/protocol/http2/input.rb:48
1069
+ def close(error = T.unsafe(nil)); end
1070
+
1071
+ # Read the next chunk of data, requesting window updates as needed.
1072
+ # @returns [String | Nil] The next chunk, or `nil` if the body is complete.
1073
+ #
1074
+ # pkg:gem/async-http#lib/async/http/protocol/http2/input.rb:26
1075
+ def read; end
1076
+ end
1077
+
1078
+ # pkg:gem/async-http#lib/async/http/protocol/http2/connection.rb:20
1079
+ Async::HTTP::Protocol::HTTP2::METHOD = T.let(T.unsafe(nil), String)
1080
+
1081
+ # Writes body data to an HTTP/2 stream, respecting flow control windows.
1082
+ #
1083
+ # pkg:gem/async-http#lib/async/http/protocol/http2/output.rb:13
1084
+ class Async::HTTP::Protocol::HTTP2::Output
1085
+ # Initialize the output handler.
1086
+ # @parameter stream [Stream] The HTTP/2 stream to write to.
1087
+ # @parameter body [Protocol::HTTP::Body::Readable] The body to read from.
1088
+ # @parameter trailer [Protocol::HTTP::Headers | Nil] Optional trailing headers.
1089
+ #
1090
+ # pkg:gem/async-http#lib/async/http/protocol/http2/output.rb:18
1091
+ def initialize(stream, body, trailer = T.unsafe(nil)); end
1092
+
1093
+ # This method should only be called from within the context of the output task.
1094
+ #
1095
+ # pkg:gem/async-http#lib/async/http/protocol/http2/output.rb:88
1096
+ def close(error = T.unsafe(nil)); end
1097
+
1098
+ # Close the wire output without cancelling a streamable body. This allows bidirectional bodies to observe an orderly input closure and finish normally. A non-streaming producer has no input side through which closure can propagate, so it is stopped directly.
1099
+ #
1100
+ # pkg:gem/async-http#lib/async/http/protocol/http2/output.rb:102
1101
+ def close_stream; end
1102
+
1103
+ # Finish writing to the stream.
1104
+ # @parameter error [Exception | Nil] An optional error that caused the close.
1105
+ #
1106
+ # pkg:gem/async-http#lib/async/http/protocol/http2/output.rb:80
1107
+ def close_write(error = T.unsafe(nil)); end
1108
+
1109
+ # Start an asynchronous task to write the body to the stream.
1110
+ #
1111
+ # pkg:gem/async-http#lib/async/http/protocol/http2/output.rb:32
1112
+ def start(parent: T.unsafe(nil)); end
1113
+
1114
+ # This method should only be called from within the context of the HTTP/2 stream.
1115
+ #
1116
+ # pkg:gem/async-http#lib/async/http/protocol/http2/output.rb:94
1117
+ def stop(error); end
1118
+
1119
+ # pkg:gem/async-http#lib/async/http/protocol/http2/output.rb:29
1120
+ def trailer; end
1121
+
1122
+ # Signal that the flow control window has been updated.
1123
+ # @parameter size [Integer] The new window size.
1124
+ # @returns [Boolean] Always returns `true`.
1125
+ #
1126
+ # pkg:gem/async-http#lib/async/http/protocol/http2/output.rb:45
1127
+ def window_updated(size); end
1128
+
1129
+ # Write a chunk of data to the HTTP/2 stream, respecting flow control.
1130
+ # @parameter chunk [String] The data to write.
1131
+ #
1132
+ # pkg:gem/async-http#lib/async/http/protocol/http2/output.rb:55
1133
+ def write(chunk); end
1134
+
1135
+ private
1136
+
1137
+ # Reads chunks from the given body and writes them to the stream as fast as possible.
1138
+ #
1139
+ # pkg:gem/async-http#lib/async/http/protocol/http2/output.rb:129
1140
+ def passthrough(task); end
1141
+
1142
+ # Send `maximum_size` bytes of data using the specified `stream`. If the buffer has no more chunks, `END_STREAM` will be sent on the final chunk.
1143
+ # @param maximum_size [Integer] send up to this many bytes of data.
1144
+ # @param stream [Stream] the stream to use for sending data frames.
1145
+ # @return [String, nil] any data that could not be written.
1146
+ #
1147
+ # pkg:gem/async-http#lib/async/http/protocol/http2/output.rb:155
1148
+ def send_data(stream, chunk, maximum_size); end
1149
+
1150
+ # pkg:gem/async-http#lib/async/http/protocol/http2/output.rb:116
1151
+ def stream(task); end
1152
+ end
1153
+
1154
+ # pkg:gem/async-http#lib/async/http/protocol/http2/connection.rb:21
1155
+ Async::HTTP::Protocol::HTTP2::PATH = T.let(T.unsafe(nil), String)
1156
+
1157
+ # pkg:gem/async-http#lib/async/http/protocol/http2/connection.rb:24
1158
+ Async::HTTP::Protocol::HTTP2::PROTOCOL = T.let(T.unsafe(nil), String)
1159
+
1160
+ # Typically used on the server side to represent an incoming request, and write the response.
1161
+ #
1162
+ # pkg:gem/async-http#lib/async/http/protocol/http2/request.rb:14
1163
+ class Async::HTTP::Protocol::HTTP2::Request < ::Async::HTTP::Protocol::Request
1164
+ # Initialize the request from an HTTP/2 stream.
1165
+ # @parameter stream [Stream] The HTTP/2 stream for this request.
1166
+ #
1167
+ # pkg:gem/async-http#lib/async/http/protocol/http2/request.rb:125
1168
+ def initialize(stream); end
1169
+
1170
+ # @returns [Connection] The underlying HTTP/2 connection.
1171
+ #
1172
+ # pkg:gem/async-http#lib/async/http/protocol/http2/request.rb:134
1173
+ def connection; end
1174
+
1175
+ # @returns [Boolean] Whether connection hijacking is supported (not available for HTTP/2).
1176
+ #
1177
+ # pkg:gem/async-http#lib/async/http/protocol/http2/request.rb:144
1178
+ def hijack?; end
1179
+
1180
+ # Send a response back to the client via the HTTP/2 stream.
1181
+ # @parameter response [Protocol::HTTP::Response | Nil] The response to send.
1182
+ #
1183
+ # pkg:gem/async-http#lib/async/http/protocol/http2/request.rb:154
1184
+ def send_response(response); end
1185
+
1186
+ # pkg:gem/async-http#lib/async/http/protocol/http2/request.rb:131
1187
+ def stream; end
1188
+
1189
+ # @returns [Boolean] Whether the request has the required pseudo-headers.
1190
+ #
1191
+ # pkg:gem/async-http#lib/async/http/protocol/http2/request.rb:139
1192
+ def valid?; end
1193
+
1194
+ # Write an interim (1xx) response to the client.
1195
+ # @parameter status [Integer] The interim HTTP status code.
1196
+ # @parameter headers [Hash | Nil] Optional interim response headers.
1197
+ #
1198
+ # pkg:gem/async-http#lib/async/http/protocol/http2/request.rb:190
1199
+ def write_interim_response(status, headers = T.unsafe(nil)); end
1200
+ end
1201
+
1202
+ # pkg:gem/async-http#lib/async/http/protocol/http2/request.rb:148
1203
+ Async::HTTP::Protocol::HTTP2::Request::NO_RESPONSE = T.let(T.unsafe(nil), Array)
1204
+
1205
+ # Represents the HTTP/2 stream associated with an incoming server-side request.
1206
+ #
1207
+ # pkg:gem/async-http#lib/async/http/protocol/http2/request.rb:16
1208
+ class Async::HTTP::Protocol::HTTP2::Request::Stream < ::Async::HTTP::Protocol::HTTP2::Stream
1209
+ # Initialize the request stream.
1210
+ #
1211
+ # pkg:gem/async-http#lib/async/http/protocol/http2/request.rb:18
1212
+ def initialize(*); end
1213
+
1214
+ # Called when the stream is closed.
1215
+ # @parameter error [Exception | Nil] The error that caused the close, if any.
1216
+ #
1217
+ # pkg:gem/async-http#lib/async/http/protocol/http2/request.rb:116
1218
+ def closed(error); end
1219
+
1220
+ # Write a failure response with the given status code and error class name.
1221
+ # @parameter status [Integer] The HTTP status code to send.
1222
+ # @parameter error [Exception] The error which caused the request to fail.
1223
+ #
1224
+ # pkg:gem/async-http#lib/async/http/protocol/http2/request.rb:30
1225
+ def fail_request(status, error); end
1226
+
1227
+ # Process the initial headers received from the client and construct the request.
1228
+ # @parameter headers [Array] The list of header key-value pairs.
1229
+ # @parameter end_stream [Boolean] Whether the stream is complete after these headers.
1230
+ #
1231
+ # pkg:gem/async-http#lib/async/http/protocol/http2/request.rb:53
1232
+ def receive_initial_headers(headers, end_stream); end
1233
+
1234
+ # pkg:gem/async-http#lib/async/http/protocol/http2/request.rb:25
1235
+ def request; end
1236
+ end
1237
+
1238
+ # Typically used on the client side for writing a request and reading the incoming response.
1239
+ #
1240
+ # pkg:gem/async-http#lib/async/http/protocol/http2/response.rb:16
1241
+ class Async::HTTP::Protocol::HTTP2::Response < ::Async::HTTP::Protocol::Response
1242
+ # Initialize the response from an HTTP/2 stream.
1243
+ # @parameter stream [Stream] The HTTP/2 stream for this response.
1244
+ #
1245
+ # pkg:gem/async-http#lib/async/http/protocol/http2/response.rb:141
1246
+ def initialize(stream); end
1247
+
1248
+ # Build a request object from push promise headers.
1249
+ # @parameter headers [Array] The push promise pseudo-headers and headers.
1250
+ # @returns [Protocol::HTTP::Request] The constructed request.
1251
+ #
1252
+ # pkg:gem/async-http#lib/async/http/protocol/http2/response.rb:197
1253
+ def build_request(headers); end
1254
+
1255
+ # Close this response as quickly as possible. If the response body is still active, cancel the HTTP/2 exchange rather than draining it.
1256
+ # @parameter error [Exception | Nil] The error which closed the response.
1257
+ #
1258
+ # pkg:gem/async-http#lib/async/http/protocol/http2/response.rb:175
1259
+ def close(error = T.unsafe(nil)); end
1260
+
1261
+ # @returns [Connection] The underlying HTTP/2 connection.
1262
+ #
1263
+ # pkg:gem/async-http#lib/async/http/protocol/http2/response.rb:164
1264
+ def connection; end
1265
+
1266
+ # @returns [Boolean] Whether the original request was a HEAD request.
1267
+ #
1268
+ # pkg:gem/async-http#lib/async/http/protocol/http2/response.rb:185
1269
+ def head?; end
1270
+
1271
+ # Assign the connection pool, releasing the connection when the stream is closed.
1272
+ # @parameter pool [Async::Pool::Controller] The connection pool.
1273
+ #
1274
+ # pkg:gem/async-http#lib/async/http/protocol/http2/response.rb:153
1275
+ def pool=(pool); end
1276
+
1277
+ # pkg:gem/async-http#lib/async/http/protocol/http2/response.rb:149
1278
+ def request; end
1279
+
1280
+ # Send a request and read it into this response.
1281
+ #
1282
+ # pkg:gem/async-http#lib/async/http/protocol/http2/response.rb:230
1283
+ def send_request(request); end
1284
+
1285
+ # pkg:gem/async-http#lib/async/http/protocol/http2/response.rb:148
1286
+ def stream; end
1287
+
1288
+ # @returns [Boolean] Whether the response has a valid status.
1289
+ #
1290
+ # pkg:gem/async-http#lib/async/http/protocol/http2/response.rb:190
1291
+ def valid?; end
1292
+
1293
+ # Wait for the response headers to be received.
1294
+ #
1295
+ # pkg:gem/async-http#lib/async/http/protocol/http2/response.rb:169
1296
+ def wait; end
1297
+ end
1298
+
1299
+ # Represents the HTTP/2 stream associated with an outgoing client-side response.
1300
+ #
1301
+ # pkg:gem/async-http#lib/async/http/protocol/http2/response.rb:18
1302
+ class Async::HTTP::Protocol::HTTP2::Response::Stream < ::Async::HTTP::Protocol::HTTP2::Stream
1303
+ # Initialize the response stream.
1304
+ #
1305
+ # pkg:gem/async-http#lib/async/http/protocol/http2/response.rb:20
1306
+ def initialize(*); end
1307
+
1308
+ # Handle a push promise stream from the server.
1309
+ # @parameter promised_stream_id [Integer] The stream ID for the promised resource.
1310
+ # @parameter headers [Array] The promise headers.
1311
+ #
1312
+ # pkg:gem/async-http#lib/async/http/protocol/http2/response.rb:45
1313
+ def accept_push_promise_stream(promised_stream_id, headers); end
1314
+
1315
+ # Called when the stream is closed.
1316
+ # @parameter error [Exception | Nil] The error that caused the close, if any.
1317
+ #
1318
+ # pkg:gem/async-http#lib/async/http/protocol/http2/response.rb:125
1319
+ def closed(error); end
1320
+
1321
+ # This should be invoked from the background reader, and notifies the task waiting for the headers that we are done.
1322
+ #
1323
+ # pkg:gem/async-http#lib/async/http/protocol/http2/response.rb:50
1324
+ def receive_initial_headers(headers, end_stream); end
1325
+
1326
+ # Process interim (1xx) response headers.
1327
+ # @parameter status [Integer] The interim status code.
1328
+ # @parameter headers [Array] The interim response headers.
1329
+ #
1330
+ # pkg:gem/async-http#lib/async/http/protocol/http2/response.rb:102
1331
+ def receive_interim_headers(status, headers); end
1332
+
1333
+ # pkg:gem/async-http#lib/async/http/protocol/http2/response.rb:28
1334
+ def response; end
1335
+
1336
+ # Wait for the headers to be received or for stream reset.
1337
+ #
1338
+ # pkg:gem/async-http#lib/async/http/protocol/http2/response.rb:113
1339
+ def wait; end
1340
+
1341
+ # Wait for the response headers and return the response body.
1342
+ # @returns [Protocol::HTTP::Body::Readable | Nil] The response body.
1343
+ #
1344
+ # pkg:gem/async-http#lib/async/http/protocol/http2/response.rb:32
1345
+ def wait_for_input; end
1346
+ end
1347
+
1348
+ # pkg:gem/async-http#lib/async/http/protocol/http2/connection.rb:19
1349
+ Async::HTTP::Protocol::HTTP2::SCHEME = T.let(T.unsafe(nil), String)
1350
+
1351
+ # The default settings for the server.
1352
+ #
1353
+ # pkg:gem/async-http#lib/async/http/protocol/http2.rb:42
1354
+ Async::HTTP::Protocol::HTTP2::SERVER_SETTINGS = T.let(T.unsafe(nil), Hash)
1355
+
1356
+ # pkg:gem/async-http#lib/async/http/protocol/http2/connection.rb:23
1357
+ Async::HTTP::Protocol::HTTP2::STATUS = T.let(T.unsafe(nil), String)
1358
+
1359
+ # An HTTP/2 server connection that receives requests and sends responses.
1360
+ #
1361
+ # pkg:gem/async-http#lib/async/http/protocol/http2/server.rb:17
1362
+ class Async::HTTP::Protocol::HTTP2::Server < ::Protocol::HTTP2::Server
1363
+ include ::Async::HTTP::Protocol::HTTP2::Connection
1364
+
1365
+ # Initialize the HTTP/2 server with an IO stream.
1366
+ # @parameter stream [IO::Stream] The underlying stream.
1367
+ #
1368
+ # pkg:gem/async-http#lib/async/http/protocol/http2/server.rb:22
1369
+ def initialize(stream); end
1370
+
1371
+ # Accept a new stream from a client.
1372
+ # @parameter stream_id [Integer] The stream ID assigned by the client.
1373
+ #
1374
+ # pkg:gem/async-http#lib/async/http/protocol/http2/server.rb:37
1375
+ def accept_stream(stream_id); end
1376
+
1377
+ # Close the server connection and stop accepting requests.
1378
+ #
1379
+ # pkg:gem/async-http#lib/async/http/protocol/http2/server.rb:44
1380
+ def close(error = T.unsafe(nil)); end
1381
+
1382
+ # Enumerate incoming requests, yielding each one for processing.
1383
+ # @yields {|request| ...} Each incoming request.
1384
+ # @parameter request [Request] The incoming HTTP/2 request.
1385
+ #
1386
+ # pkg:gem/async-http#lib/async/http/protocol/http2/server.rb:53
1387
+ def each(task: T.unsafe(nil)); end
1388
+
1389
+ # pkg:gem/async-http#lib/async/http/protocol/http2/server.rb:33
1390
+ def requests; end
1391
+ end
1392
+
1393
+ # An HTTP/2 stream that manages headers, input data, and output data for a single request/response exchange.
1394
+ #
1395
+ # pkg:gem/async-http#lib/async/http/protocol/http2/stream.rb:18
1396
+ class Async::HTTP::Protocol::HTTP2::Stream < ::Protocol::HTTP2::Stream
1397
+ # Initialize the stream state.
1398
+ #
1399
+ # pkg:gem/async-http#lib/async/http/protocol/http2/stream.rb:20
1400
+ def initialize(*); end
1401
+
1402
+ # Add a header to the stream, validating against HTTP/2 constraints.
1403
+ # @parameter key [String] The header name.
1404
+ # @parameter value [String] The header value.
1405
+ #
1406
+ # pkg:gem/async-http#lib/async/http/protocol/http2/stream.rb:47
1407
+ def add_header(key, value, trailer: T.unsafe(nil)); end
1408
+
1409
+ # When the stream transitions to the closed state, this method is called. There are roughly two ways this can happen:
1410
+ # - A frame is received which causes this stream to enter the closed state. This method will be invoked from the background reader task.
1411
+ # - A frame is sent which causes this stream to enter the closed state. This method will be invoked from that task.
1412
+ # While the input stream is relatively straight forward, the output stream can trigger the second case above
1413
+ #
1414
+ # pkg:gem/async-http#lib/async/http/protocol/http2/stream.rb:212
1415
+ def closed(error); end
1416
+
1417
+ # Close the application-facing receiving side of the stream. While local output remains active, incoming data is discarded with flow-control updates. Once local output is also closed, the remaining wire stream is terminated without an error.
1418
+ # @parameter input [Input] The input body being closed.
1419
+ # @parameter error [Exception | Nil] The error which closed the input.
1420
+ #
1421
+ # pkg:gem/async-http#lib/async/http/protocol/http2/stream.rb:143
1422
+ def finish_input(input, error = T.unsafe(nil)); end
1423
+
1424
+ # Called when the output terminates normally.
1425
+ #
1426
+ # pkg:gem/async-http#lib/async/http/protocol/http2/stream.rb:164
1427
+ def finish_output(error = T.unsafe(nil)); end
1428
+
1429
+ # pkg:gem/async-http#lib/async/http/protocol/http2/stream.rb:38
1430
+ def headers; end
1431
+
1432
+ # pkg:gem/async-http#lib/async/http/protocol/http2/stream.rb:38
1433
+ def headers=(_arg0); end
1434
+
1435
+ # pkg:gem/async-http#lib/async/http/protocol/http2/stream.rb:42
1436
+ def input; end
1437
+
1438
+ # pkg:gem/async-http#lib/async/http/protocol/http2/stream.rb:40
1439
+ def pool; end
1440
+
1441
+ # pkg:gem/async-http#lib/async/http/protocol/http2/stream.rb:40
1442
+ def pool=(_arg0); end
1443
+
1444
+ # Prepare the input stream which will be used for incoming data frames.
1445
+ # @return [Input] the input body.
1446
+ #
1447
+ # pkg:gem/async-http#lib/async/http/protocol/http2/stream.rb:97
1448
+ def prepare_input(length); end
1449
+
1450
+ # Process an incoming DATA frame and write it to the input body.
1451
+ # @parameter frame [Protocol::HTTP2::DataFrame] The data frame to process.
1452
+ # @returns [String] The unpacked data.
1453
+ #
1454
+ # pkg:gem/async-http#lib/async/http/protocol/http2/stream.rb:117
1455
+ def process_data(frame); end
1456
+
1457
+ # Process an incoming HEADERS frame, dispatching to initial or trailing header handling.
1458
+ # @parameter frame [Protocol::HTTP2::HeadersFrame] The headers frame to process.
1459
+ #
1460
+ # pkg:gem/async-http#lib/async/http/protocol/http2/stream.rb:70
1461
+ def process_headers(frame); end
1462
+
1463
+ # Process trailing headers received after the body.
1464
+ # @parameter headers [Array] The trailing header key-value pairs.
1465
+ # @parameter end_stream [Boolean] Whether the stream ends after these headers.
1466
+ #
1467
+ # pkg:gem/async-http#lib/async/http/protocol/http2/stream.rb:62
1468
+ def receive_trailing_headers(headers, end_stream); end
1469
+
1470
+ # Set the body and begin sending it.
1471
+ #
1472
+ # pkg:gem/async-http#lib/async/http/protocol/http2/stream.rb:157
1473
+ def send_body(body, trailer = T.unsafe(nil)); end
1474
+
1475
+ # Send data and apply any pending application-side closure.
1476
+ #
1477
+ # pkg:gem/async-http#lib/async/http/protocol/http2/stream.rb:202
1478
+ def send_data(*, **, &); end
1479
+
1480
+ # Send headers and apply any pending application-side closure.
1481
+ #
1482
+ # pkg:gem/async-http#lib/async/http/protocol/http2/stream.rb:195
1483
+ def send_headers(*, **, &); end
1484
+
1485
+ # Update the local flow control window after receiving data.
1486
+ # @parameter frame [Protocol::HTTP2::DataFrame] The received data frame.
1487
+ #
1488
+ # pkg:gem/async-http#lib/async/http/protocol/http2/stream.rb:107
1489
+ def update_local_window(frame); end
1490
+
1491
+ # @returns [Input | Nil] The input body for this stream, if available.
1492
+ #
1493
+ # pkg:gem/async-http#lib/async/http/protocol/http2/stream.rb:91
1494
+ def wait_for_input; end
1495
+
1496
+ # Called when the flow control window is updated.
1497
+ # @parameter size [Integer] The new window size.
1498
+ # @returns [Boolean] Always returns `true`.
1499
+ #
1500
+ # pkg:gem/async-http#lib/async/http/protocol/http2/stream.rb:186
1501
+ def window_updated(size); end
1502
+
1503
+ private
1504
+
1505
+ # If both application-facing directions are closed but the peer has not finished, terminate the remaining wire stream without an error.
1506
+ #
1507
+ # pkg:gem/async-http#lib/async/http/protocol/http2/stream.rb:244
1508
+ def close_if_finished; end
1509
+ end
1510
+
1511
+ # pkg:gem/async-http#lib/async/http/protocol/http2/connection.rb:28
1512
+ Async::HTTP::Protocol::HTTP2::TRAILER = T.let(T.unsafe(nil), String)
1513
+
1514
+ # pkg:gem/async-http#lib/async/http/protocol/http2.rb:21
1515
+ Async::HTTP::Protocol::HTTP2::VERSION = T.let(T.unsafe(nil), String)
1516
+
1517
+ # pkg:gem/async-http#lib/async/http/protocol/http.rb:17
1518
+ Async::HTTP::Protocol::HTTP::HTTP2_PREFACE = T.let(T.unsafe(nil), String)
1519
+
1520
+ # pkg:gem/async-http#lib/async/http/protocol/http.rb:18
1521
+ Async::HTTP::Protocol::HTTP::HTTP2_PREFACE_SIZE = T.let(T.unsafe(nil), Integer)
1522
+
1523
+ # A server that supports both HTTP1.0 and HTTP1.1 semantics by detecting the version of the request.
1524
+ #
1525
+ # pkg:gem/async-http#lib/async/http/protocol/https.rb:17
1526
+ class Async::HTTP::Protocol::HTTPS
1527
+ extend ::Async::HTTP::Protocol::Defaulton
1528
+
1529
+ # Initialize the HTTPS protocol negotiator.
1530
+ # @parameter handlers [Hash] A mapping of ALPN protocol names to protocol classes.
1531
+ # @parameter options [Hash] Per-protocol options keyed by protocol class.
1532
+ #
1533
+ # pkg:gem/async-http#lib/async/http/protocol/https.rb:29
1534
+ def initialize(handlers = T.unsafe(nil), **options); end
1535
+
1536
+ # Register a protocol handler for a given ALPN protocol name.
1537
+ # @parameter name [String] The ALPN protocol name.
1538
+ # @parameter protocol [Class] The protocol class to handle connections.
1539
+ # @parameter options [Hash] Options to pass when creating client or server instances.
1540
+ #
1541
+ # pkg:gem/async-http#lib/async/http/protocol/https.rb:38
1542
+ def add(name, protocol, **options); end
1543
+
1544
+ # Create a client for an outbound connection.
1545
+ #
1546
+ # @parameter peer [IO] The peer to communicate with.
1547
+ # @parameter options [Hash] Options to pass to the client instance.
1548
+ #
1549
+ # pkg:gem/async-http#lib/async/http/protocol/https.rb:66
1550
+ def client(peer, **options); end
1551
+
1552
+ # @returns [Array] The names of the supported protocol, used for Application Layer Protocol Negotiation (ALPN).
1553
+ #
1554
+ # pkg:gem/async-http#lib/async/http/protocol/https.rb:85
1555
+ def names; end
1556
+
1557
+ # Determine the protocol of the peer and return the appropriate protocol class.
1558
+ #
1559
+ # Use TLS Application Layer Protocol Negotiation (ALPN) to determine the protocol.
1560
+ #
1561
+ # @parameter peer [IO] The peer to communicate with.
1562
+ # @returns [Class] The protocol class to use.
1563
+ #
1564
+ # pkg:gem/async-http#lib/async/http/protocol/https.rb:49
1565
+ def protocol_for(peer); end
1566
+
1567
+ # Create a server for an inbound connection.
1568
+ #
1569
+ # @parameter peer [IO] The peer to communicate with.
1570
+ # @parameter options [Hash] Options to pass to the server instance.
1571
+ #
1572
+ # pkg:gem/async-http#lib/async/http/protocol/https.rb:77
1573
+ def server(peer, **options); end
1574
+ end
1575
+
1576
+ # The protocol classes for each supported protocol.
1577
+ #
1578
+ # pkg:gem/async-http#lib/async/http/protocol/https.rb:19
1579
+ Async::HTTP::Protocol::HTTPS::HANDLERS = T.let(T.unsafe(nil), Hash)
1580
+
1581
+ # An incoming HTTP request generated by server protocol implementations.
1582
+ #
1583
+ # pkg:gem/async-http#lib/async/http/protocol/request.rb:15
1584
+ class Async::HTTP::Protocol::Request < ::Protocol::HTTP::Request
1585
+ # @returns [Connection | Nil] The underlying protocol connection.
1586
+ #
1587
+ # pkg:gem/async-http#lib/async/http/protocol/request.rb:17
1588
+ def connection; end
1589
+
1590
+ # @returns [Boolean] Whether this request supports connection hijacking.
1591
+ #
1592
+ # pkg:gem/async-http#lib/async/http/protocol/request.rb:22
1593
+ def hijack?; end
1594
+
1595
+ # @returns [String] A string representation of the request.
1596
+ #
1597
+ # pkg:gem/async-http#lib/async/http/protocol/request.rb:43
1598
+ def inspect; end
1599
+
1600
+ # @returns [Protocol::HTTP::Peer | Nil] The peer associated with this connection.
1601
+ #
1602
+ # pkg:gem/async-http#lib/async/http/protocol/request.rb:33
1603
+ def peer; end
1604
+
1605
+ # @returns [Addrinfo | Nil] The remote address of the peer.
1606
+ #
1607
+ # pkg:gem/async-http#lib/async/http/protocol/request.rb:38
1608
+ def remote_address; end
1609
+
1610
+ # Write an interim (1xx) response back to the client.
1611
+ # @parameter status [Integer] The interim HTTP status code.
1612
+ # @parameter headers [Hash | Nil] Optional headers to include.
1613
+ #
1614
+ # pkg:gem/async-http#lib/async/http/protocol/request.rb:29
1615
+ def write_interim_response(status, headers = T.unsafe(nil)); end
1616
+ end
1617
+
1618
+ # An HTTP response received from a server via client protocol implementations.
1619
+ #
1620
+ # pkg:gem/async-http#lib/async/http/protocol/response.rb:14
1621
+ class Async::HTTP::Protocol::Response < ::Protocol::HTTP::Response
1622
+ # @returns [Connection | Nil] The underlying protocol connection.
1623
+ #
1624
+ # pkg:gem/async-http#lib/async/http/protocol/response.rb:16
1625
+ def connection; end
1626
+
1627
+ # @returns [Boolean] Whether this response supports connection hijacking.
1628
+ #
1629
+ # pkg:gem/async-http#lib/async/http/protocol/response.rb:21
1630
+ def hijack?; end
1631
+
1632
+ # @returns [String] A string representation of the response.
1633
+ #
1634
+ # pkg:gem/async-http#lib/async/http/protocol/response.rb:36
1635
+ def inspect; end
1636
+
1637
+ # @returns [Protocol::HTTP::Peer | Nil] The peer associated with this connection.
1638
+ #
1639
+ # pkg:gem/async-http#lib/async/http/protocol/response.rb:26
1640
+ def peer; end
1641
+
1642
+ # @returns [Addrinfo | Nil] The remote address of the peer.
1643
+ #
1644
+ # pkg:gem/async-http#lib/async/http/protocol/response.rb:31
1645
+ def remote_address; end
1646
+ end
1647
+
1648
+ # pkg:gem/async-http#lib/async/http/body/writable.rb:12
1649
+ class Protocol::HTTP::Body::Writable < ::Protocol::HTTP::Body::Readable; end