httpsensible 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.rubocop.yml +4 -0
- data/.ruby-version +1 -0
- data/.vscode/settings.json +8 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +18 -0
- data/LICENSE.txt +21 -0
- data/README.md +45 -0
- data/Rakefile +20 -0
- data/lib/httpsensible/client/response.rb +54 -0
- data/lib/httpsensible/client.rb +39 -0
- data/lib/httpsensible/jwt.rb +26 -0
- data/lib/httpsensible/version.rb +6 -0
- data/lib/httpsensible.rb +10 -0
- data/sorbet/config +4 -0
- data/sorbet/rbi/annotations/rainbow.rbi +269 -0
- data/sorbet/rbi/dsl/active_support/callbacks.rbi +22 -0
- data/sorbet/rbi/gems/activesupport@7.0.6.rbi +14 -0
- data/sorbet/rbi/gems/addressable@2.8.4.rbi +1954 -0
- data/sorbet/rbi/gems/amazing_print@1.5.0.rbi +923 -0
- data/sorbet/rbi/gems/ast@2.4.2.rbi +584 -0
- data/sorbet/rbi/gems/concurrent-ruby@1.2.2.rbi +8 -0
- data/sorbet/rbi/gems/crack@0.4.5.rbi +144 -0
- data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +1083 -0
- data/sorbet/rbi/gems/erubi@1.12.0.rbi +145 -0
- data/sorbet/rbi/gems/hashdiff@1.0.1.rbi +350 -0
- data/sorbet/rbi/gems/http-2-next@0.5.1.rbi +1441 -0
- data/sorbet/rbi/gems/httpx@0.24.1.rbi +3255 -0
- data/sorbet/rbi/gems/i18n@1.14.1.rbi +8 -0
- data/sorbet/rbi/gems/io-console@0.6.0.rbi +8 -0
- data/sorbet/rbi/gems/irb@1.7.1.rbi +342 -0
- data/sorbet/rbi/gems/json@2.6.3.rbi +1533 -0
- data/sorbet/rbi/gems/jwt@2.7.1.rbi +1404 -0
- data/sorbet/rbi/gems/language_server-protocol@3.17.0.3.rbi +14237 -0
- data/sorbet/rbi/gems/minitest-focus@1.3.1.rbi +91 -0
- data/sorbet/rbi/gems/minitest@5.18.1.rbi +1503 -0
- data/sorbet/rbi/gems/netrc@0.11.0.rbi +158 -0
- data/sorbet/rbi/gems/parallel@1.23.0.rbi +273 -0
- data/sorbet/rbi/gems/parser@3.2.2.3.rbi +7253 -0
- data/sorbet/rbi/gems/prettier_print@1.2.1.rbi +951 -0
- data/sorbet/rbi/gems/public_suffix@5.0.1.rbi +935 -0
- data/sorbet/rbi/gems/racc@1.7.1.rbi +161 -0
- data/sorbet/rbi/gems/rack@3.0.8.rbi +5183 -0
- data/sorbet/rbi/gems/rainbow@3.1.1.rbi +402 -0
- data/sorbet/rbi/gems/rake@13.0.6.rbi +3024 -0
- data/sorbet/rbi/gems/rbi@0.0.16.rbi +2999 -0
- data/sorbet/rbi/gems/regexp_parser@2.8.1.rbi +3749 -0
- data/sorbet/rbi/gems/reline@0.3.6.rbi +8 -0
- data/sorbet/rbi/gems/rexml@3.2.5.rbi +4717 -0
- data/sorbet/rbi/gems/rubocop-ast@1.29.0.rbi +6985 -0
- data/sorbet/rbi/gems/rubocop-minitest@0.31.0.rbi +8 -0
- data/sorbet/rbi/gems/rubocop-performance@1.18.0.rbi +8 -0
- data/sorbet/rbi/gems/rubocop-rails@2.20.2.rbi +8 -0
- data/sorbet/rbi/gems/rubocop-rake@0.6.0.rbi +8 -0
- data/sorbet/rbi/gems/rubocop-shopify@2.14.0.rbi +8 -0
- data/sorbet/rbi/gems/rubocop-sorbet@0.7.0.rbi +8 -0
- data/sorbet/rbi/gems/rubocop-standard@7.1.0.rbi +8 -0
- data/sorbet/rbi/gems/rubocop@1.54.1.rbi +56172 -0
- data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +1317 -0
- data/sorbet/rbi/gems/spoom@1.2.2.rbi +2994 -0
- data/sorbet/rbi/gems/syntax_tree@6.1.1.rbi +22855 -0
- data/sorbet/rbi/gems/tapioca@0.11.7.rbi +3347 -0
- data/sorbet/rbi/gems/thor@1.2.2.rbi +3965 -0
- data/sorbet/rbi/gems/tzinfo@2.0.6.rbi +8 -0
- data/sorbet/rbi/gems/unicode-display_width@2.4.2.rbi +65 -0
- data/sorbet/rbi/gems/unparser@0.6.8.rbi +4525 -0
- data/sorbet/rbi/gems/webmock@3.18.1.rbi +1756 -0
- data/sorbet/rbi/gems/yard-sorbet@0.8.1.rbi +428 -0
- data/sorbet/rbi/gems/yard@0.9.34.rbi +18219 -0
- data/sorbet/tapioca/config.yml +13 -0
- data/sorbet/tapioca/require.rb +4 -0
- metadata +190 -0
|
@@ -0,0 +1,1441 @@
|
|
|
1
|
+
# typed: true
|
|
2
|
+
|
|
3
|
+
# DO NOT EDIT MANUALLY
|
|
4
|
+
# This is an autogenerated file for types exported from the `http-2-next` gem.
|
|
5
|
+
# Please instead update this file by running `bin/tapioca gem http-2-next`.
|
|
6
|
+
|
|
7
|
+
# The following task generates this file.
|
|
8
|
+
# rake generate_huffman_table
|
|
9
|
+
#
|
|
10
|
+
# source://http-2-next//lib/http/2/next/version.rb#3
|
|
11
|
+
module HTTP2Next; end
|
|
12
|
+
|
|
13
|
+
# Default connection "fast-fail" preamble string as defined by the spec.
|
|
14
|
+
#
|
|
15
|
+
# source://http-2-next//lib/http/2/next/connection.rb#36
|
|
16
|
+
HTTP2Next::CONNECTION_PREFACE_MAGIC = T.let(T.unsafe(nil), String)
|
|
17
|
+
|
|
18
|
+
# HTTP 2.0 client connection class that implements appropriate header
|
|
19
|
+
# compression / decompression algorithms and stream management logic.
|
|
20
|
+
#
|
|
21
|
+
# Your code is responsible for driving the client object, which in turn
|
|
22
|
+
# performs all of the necessary HTTP 2.0 encoding / decoding, state
|
|
23
|
+
# management, and the rest. A simple example:
|
|
24
|
+
#
|
|
25
|
+
# @example
|
|
26
|
+
# socket = YourTransport.new
|
|
27
|
+
#
|
|
28
|
+
# conn = HTTP2Next::Client.new
|
|
29
|
+
# conn.on(:frame) {|bytes| socket << bytes }
|
|
30
|
+
#
|
|
31
|
+
# while bytes = socket.read
|
|
32
|
+
# conn << bytes
|
|
33
|
+
# end
|
|
34
|
+
#
|
|
35
|
+
# source://http-2-next//lib/http/2/next/client.rb#21
|
|
36
|
+
class HTTP2Next::Client < ::HTTP2Next::Connection
|
|
37
|
+
# Initialize new HTTP 2.0 client object.
|
|
38
|
+
#
|
|
39
|
+
# @return [Client] a new instance of Client
|
|
40
|
+
#
|
|
41
|
+
# source://http-2-next//lib/http/2/next/client.rb#23
|
|
42
|
+
def initialize(settings = T.unsafe(nil)); end
|
|
43
|
+
|
|
44
|
+
# source://http-2-next//lib/http/2/next/client.rb#43
|
|
45
|
+
def receive(frame); end
|
|
46
|
+
|
|
47
|
+
# Send an outgoing frame. Connection and stream flow control is managed
|
|
48
|
+
# by Connection class.
|
|
49
|
+
#
|
|
50
|
+
# @param frame [Hash]
|
|
51
|
+
# @see Connection
|
|
52
|
+
#
|
|
53
|
+
# source://http-2-next//lib/http/2/next/client.rb#38
|
|
54
|
+
def send(frame); end
|
|
55
|
+
|
|
56
|
+
# Emit the connection preface if not yet
|
|
57
|
+
#
|
|
58
|
+
# source://http-2-next//lib/http/2/next/client.rb#60
|
|
59
|
+
def send_connection_preface; end
|
|
60
|
+
|
|
61
|
+
# sends the preface and initializes the first stream in half-closed state
|
|
62
|
+
#
|
|
63
|
+
# @raise [ProtocolError]
|
|
64
|
+
#
|
|
65
|
+
# source://http-2-next//lib/http/2/next/client.rb#49
|
|
66
|
+
def upgrade; end
|
|
67
|
+
|
|
68
|
+
private
|
|
69
|
+
|
|
70
|
+
# source://http-2-next//lib/http/2/next/client.rb#77
|
|
71
|
+
def verify_pseudo_headers(frame); end
|
|
72
|
+
|
|
73
|
+
class << self
|
|
74
|
+
# source://http-2-next//lib/http/2/next/client.rb#70
|
|
75
|
+
def settings_header(settings); end
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# Connection encapsulates all of the connection, stream, flow-control,
|
|
80
|
+
# error management, and other processing logic required for a well-behaved
|
|
81
|
+
# HTTP 2.0 endpoint.
|
|
82
|
+
#
|
|
83
|
+
# Note that this class should not be used directly. Instead, you want to
|
|
84
|
+
# use either Client or Server class to drive the HTTP 2.0 exchange.
|
|
85
|
+
#
|
|
86
|
+
#
|
|
87
|
+
# source://http-2-next//lib/http/2/next/connection.rb#49
|
|
88
|
+
class HTTP2Next::Connection
|
|
89
|
+
include ::HTTP2Next::Error
|
|
90
|
+
include ::HTTP2Next::FlowBuffer
|
|
91
|
+
include ::HTTP2Next::Emitter
|
|
92
|
+
|
|
93
|
+
# Initializes new connection object.
|
|
94
|
+
#
|
|
95
|
+
# @return [Connection] a new instance of Connection
|
|
96
|
+
#
|
|
97
|
+
# source://http-2-next//lib/http/2/next/connection.rb#81
|
|
98
|
+
def initialize(settings = T.unsafe(nil)); end
|
|
99
|
+
|
|
100
|
+
# source://http-2-next//lib/http/2/next/connection.rb#401
|
|
101
|
+
def <<(data); end
|
|
102
|
+
|
|
103
|
+
# Number of active streams between client and server (reserved streams
|
|
104
|
+
# are not counted towards the stream limit).
|
|
105
|
+
#
|
|
106
|
+
# source://http-2-next//lib/http/2/next/connection.rb#74
|
|
107
|
+
def active_stream_count; end
|
|
108
|
+
|
|
109
|
+
# @return [Boolean]
|
|
110
|
+
#
|
|
111
|
+
# source://http-2-next//lib/http/2/next/connection.rb#112
|
|
112
|
+
def closed?; end
|
|
113
|
+
|
|
114
|
+
# Sends a GOAWAY frame indicating that the peer should stop creating
|
|
115
|
+
# new streams for current connection.
|
|
116
|
+
#
|
|
117
|
+
# Endpoints MAY append opaque data to the payload of any GOAWAY frame.
|
|
118
|
+
# Additional debug data is intended for diagnostic purposes only and
|
|
119
|
+
# carries no semantic value. Debug data MUST NOT be persistently stored,
|
|
120
|
+
# since it could contain sensitive information.
|
|
121
|
+
#
|
|
122
|
+
# @param error [Symbol]
|
|
123
|
+
# @param payload [String]
|
|
124
|
+
#
|
|
125
|
+
# source://http-2-next//lib/http/2/next/connection.rb#155
|
|
126
|
+
def goaway(error = T.unsafe(nil), payload = T.unsafe(nil)); end
|
|
127
|
+
|
|
128
|
+
# Current settings value for local and peer
|
|
129
|
+
#
|
|
130
|
+
# source://http-2-next//lib/http/2/next/connection.rb#66
|
|
131
|
+
def local_settings; end
|
|
132
|
+
|
|
133
|
+
# Size of current connection flow control window (by default, set to
|
|
134
|
+
# infinity, but is automatically updated on receipt of peer settings).
|
|
135
|
+
#
|
|
136
|
+
# source://http-2-next//lib/http/2/next/connection.rb#61
|
|
137
|
+
def local_window; end
|
|
138
|
+
|
|
139
|
+
# Max number of streams that can be in-transit in this connection.
|
|
140
|
+
#
|
|
141
|
+
# source://http-2-next//lib/http/2/next/connection.rb#77
|
|
142
|
+
def max_streams=(_arg0); end
|
|
143
|
+
|
|
144
|
+
# Allocates new stream for current connection.
|
|
145
|
+
#
|
|
146
|
+
# @param priority [Integer]
|
|
147
|
+
# @param window [Integer]
|
|
148
|
+
# @param parent [Stream]
|
|
149
|
+
# @raise [ConnectionClosed]
|
|
150
|
+
#
|
|
151
|
+
# source://http-2-next//lib/http/2/next/connection.rb#121
|
|
152
|
+
def new_stream(**args); end
|
|
153
|
+
|
|
154
|
+
# Pending settings value
|
|
155
|
+
# Sent but not ack'ed settings
|
|
156
|
+
#
|
|
157
|
+
# source://http-2-next//lib/http/2/next/connection.rb#70
|
|
158
|
+
def pending_settings; end
|
|
159
|
+
|
|
160
|
+
# Sends PING frame to the peer.
|
|
161
|
+
#
|
|
162
|
+
# @param payload [String] optional payload must be 8 bytes long
|
|
163
|
+
# @param blk [Proc] callback to execute when PONG is received
|
|
164
|
+
#
|
|
165
|
+
# source://http-2-next//lib/http/2/next/connection.rb#140
|
|
166
|
+
def ping(payload, &blk); end
|
|
167
|
+
|
|
168
|
+
# Decodes incoming bytes into HTTP 2.0 frames and routes them to
|
|
169
|
+
# appropriate receivers: connection frames are handled directly, and
|
|
170
|
+
# stream frames are passed to appropriate stream objects.
|
|
171
|
+
#
|
|
172
|
+
# @param data [String] Binary encoded string
|
|
173
|
+
#
|
|
174
|
+
# source://http-2-next//lib/http/2/next/connection.rb#193
|
|
175
|
+
def receive(data); end
|
|
176
|
+
|
|
177
|
+
# Returns the value of attribute remote_settings.
|
|
178
|
+
#
|
|
179
|
+
# source://http-2-next//lib/http/2/next/connection.rb#62
|
|
180
|
+
def remote_settings; end
|
|
181
|
+
|
|
182
|
+
# Returns the value of attribute remote_window.
|
|
183
|
+
#
|
|
184
|
+
# source://http-2-next//lib/http/2/next/connection.rb#62
|
|
185
|
+
def remote_window; end
|
|
186
|
+
|
|
187
|
+
# Sends a connection SETTINGS frame to the peer.
|
|
188
|
+
# The values are reflected when the corresponding ACK is received.
|
|
189
|
+
#
|
|
190
|
+
# @param settings [Array or Hash]
|
|
191
|
+
#
|
|
192
|
+
# source://http-2-next//lib/http/2/next/connection.rb#180
|
|
193
|
+
def settings(payload); end
|
|
194
|
+
|
|
195
|
+
# Connection state (:new, :closed).
|
|
196
|
+
#
|
|
197
|
+
# source://http-2-next//lib/http/2/next/connection.rb#57
|
|
198
|
+
def state; end
|
|
199
|
+
|
|
200
|
+
# Size of current connection flow control window (by default, set to
|
|
201
|
+
# infinity, but is automatically updated on receipt of peer settings).
|
|
202
|
+
#
|
|
203
|
+
# source://http-2-next//lib/http/2/next/connection.rb#61
|
|
204
|
+
def window; end
|
|
205
|
+
|
|
206
|
+
# Sends a WINDOW_UPDATE frame to the peer.
|
|
207
|
+
#
|
|
208
|
+
# @param increment [Integer]
|
|
209
|
+
#
|
|
210
|
+
# source://http-2-next//lib/http/2/next/connection.rb#171
|
|
211
|
+
def window_update(increment); end
|
|
212
|
+
|
|
213
|
+
private
|
|
214
|
+
|
|
215
|
+
# source://http-2-next//lib/http/2/next/connection.rb#764
|
|
216
|
+
def _verify_pseudo_headers(frame, mandatory_headers); end
|
|
217
|
+
|
|
218
|
+
# Activates new incoming or outgoing stream and registers appropriate
|
|
219
|
+
# connection managemet callbacks.
|
|
220
|
+
#
|
|
221
|
+
# @param id [Integer]
|
|
222
|
+
# @param priority [Integer]
|
|
223
|
+
# @param window [Integer]
|
|
224
|
+
# @param parent [Stream]
|
|
225
|
+
# @raise [StreamLimitExceeded]
|
|
226
|
+
#
|
|
227
|
+
# source://http-2-next//lib/http/2/next/connection.rb#727
|
|
228
|
+
def activate_stream(id:, **args); end
|
|
229
|
+
|
|
230
|
+
# Emit GOAWAY error indicating to peer that the connection is being
|
|
231
|
+
# aborted, and once sent, raise a local exception.
|
|
232
|
+
#
|
|
233
|
+
# @option error
|
|
234
|
+
# @option error
|
|
235
|
+
# @option error
|
|
236
|
+
# @option error
|
|
237
|
+
# @option error
|
|
238
|
+
# @option error
|
|
239
|
+
# @param error [Symbol]
|
|
240
|
+
# @param msg [String]
|
|
241
|
+
# @raise []
|
|
242
|
+
#
|
|
243
|
+
# source://http-2-next//lib/http/2/next/connection.rb#790
|
|
244
|
+
def connection_error(error = T.unsafe(nil), msg: T.unsafe(nil), e: T.unsafe(nil)); end
|
|
245
|
+
|
|
246
|
+
# Check if frame is a connection frame: SETTINGS, PING, GOAWAY, and any
|
|
247
|
+
# frame addressed to stream ID = 0.
|
|
248
|
+
#
|
|
249
|
+
# @param frame [Hash]
|
|
250
|
+
# @return [Boolean]
|
|
251
|
+
#
|
|
252
|
+
# source://http-2-next//lib/http/2/next/connection.rb#450
|
|
253
|
+
def connection_frame?(frame); end
|
|
254
|
+
|
|
255
|
+
# Process received connection frame (stream ID = 0).
|
|
256
|
+
# - Handle SETTINGS updates
|
|
257
|
+
# - Connection flow control (WINDOW_UPDATE)
|
|
258
|
+
# - Emit PONG auto-reply to PING frames
|
|
259
|
+
# - Mark connection as closed on GOAWAY
|
|
260
|
+
#
|
|
261
|
+
# @param frame [Hash]
|
|
262
|
+
#
|
|
263
|
+
# source://http-2-next//lib/http/2/next/connection.rb#464
|
|
264
|
+
def connection_management(frame); end
|
|
265
|
+
|
|
266
|
+
# Update connection settings based on parameters set by the peer.
|
|
267
|
+
#
|
|
268
|
+
# @param frame [Hash]
|
|
269
|
+
#
|
|
270
|
+
# source://http-2-next//lib/http/2/next/connection.rb#579
|
|
271
|
+
def connection_settings(frame); end
|
|
272
|
+
|
|
273
|
+
# Decode headers payload and update connection decompressor state.
|
|
274
|
+
#
|
|
275
|
+
# The receiver endpoint reassembles the header block by concatenating
|
|
276
|
+
# the individual fragments, then decompresses the block to reconstruct
|
|
277
|
+
# the header set - aka, header payloads are buffered until END_HEADERS,
|
|
278
|
+
# or an END_PROMISE flag is seen.
|
|
279
|
+
#
|
|
280
|
+
# @param frame [Hash]
|
|
281
|
+
#
|
|
282
|
+
# source://http-2-next//lib/http/2/next/connection.rb#676
|
|
283
|
+
def decode_headers(frame); end
|
|
284
|
+
|
|
285
|
+
# Applies HTTP 2.0 binary encoding to the frame.
|
|
286
|
+
#
|
|
287
|
+
# @param frame [Hash]
|
|
288
|
+
# @return [Array of Buffer] encoded frame
|
|
289
|
+
#
|
|
290
|
+
# source://http-2-next//lib/http/2/next/connection.rb#435
|
|
291
|
+
def encode(frame); end
|
|
292
|
+
|
|
293
|
+
# Encode headers payload and update connection compressor state.
|
|
294
|
+
#
|
|
295
|
+
# @param frame [Hash]
|
|
296
|
+
# @return [Array of Frame]
|
|
297
|
+
#
|
|
298
|
+
# source://http-2-next//lib/http/2/next/connection.rb#690
|
|
299
|
+
def encode_headers(frame); end
|
|
300
|
+
|
|
301
|
+
# Emit GOAWAY error indicating to peer that the connection is being
|
|
302
|
+
# aborted, and once sent, raise a local exception.
|
|
303
|
+
#
|
|
304
|
+
# @option error
|
|
305
|
+
# @option error
|
|
306
|
+
# @option error
|
|
307
|
+
# @option error
|
|
308
|
+
# @option error
|
|
309
|
+
# @option error
|
|
310
|
+
# @param error [Symbol]
|
|
311
|
+
# @param msg [String]
|
|
312
|
+
# @raise []
|
|
313
|
+
#
|
|
314
|
+
# source://http-2-next//lib/http/2/next/connection.rb#790
|
|
315
|
+
def error(error = T.unsafe(nil), msg: T.unsafe(nil), e: T.unsafe(nil)); end
|
|
316
|
+
|
|
317
|
+
# source://http-2-next//lib/http/2/next/connection.rb#801
|
|
318
|
+
def manage_state(_); end
|
|
319
|
+
|
|
320
|
+
# source://http-2-next//lib/http/2/next/connection.rb#516
|
|
321
|
+
def ping_management(frame); end
|
|
322
|
+
|
|
323
|
+
# Send an outgoing frame. DATA frames are subject to connection flow
|
|
324
|
+
# control and may be split and / or buffered based on current window size.
|
|
325
|
+
# All other frames are sent immediately.
|
|
326
|
+
#
|
|
327
|
+
# @note all frames are currently delivered in FIFO order.
|
|
328
|
+
# @param frame [Hash]
|
|
329
|
+
#
|
|
330
|
+
# source://http-2-next//lib/http/2/next/connection.rb#413
|
|
331
|
+
def send(frame); end
|
|
332
|
+
|
|
333
|
+
# Validate settings parameters. See sepc Section 6.5.2.
|
|
334
|
+
#
|
|
335
|
+
# @param role [Symbol] The sender's role: :client or :server
|
|
336
|
+
# @return nil if no error. Exception object in case of any error.
|
|
337
|
+
#
|
|
338
|
+
# source://http-2-next//lib/http/2/next/connection.rb#529
|
|
339
|
+
def validate_settings(role, settings); end
|
|
340
|
+
|
|
341
|
+
# source://http-2-next//lib/http/2/next/connection.rb#757
|
|
342
|
+
def verify_stream_order(id); end
|
|
343
|
+
end
|
|
344
|
+
|
|
345
|
+
# source://http-2-next//lib/http/2/next/connection.rb#23
|
|
346
|
+
HTTP2Next::DEFAULT_CONNECTION_SETTINGS = T.let(T.unsafe(nil), Hash)
|
|
347
|
+
|
|
348
|
+
# Default connection and stream flow control window (64KB).
|
|
349
|
+
#
|
|
350
|
+
# source://http-2-next//lib/http/2/next/connection.rb#5
|
|
351
|
+
HTTP2Next::DEFAULT_FLOW_WINDOW = T.let(T.unsafe(nil), Integer)
|
|
352
|
+
|
|
353
|
+
# Default header table size
|
|
354
|
+
#
|
|
355
|
+
# source://http-2-next//lib/http/2/next/connection.rb#8
|
|
356
|
+
HTTP2Next::DEFAULT_HEADER_SIZE = T.let(T.unsafe(nil), Integer)
|
|
357
|
+
|
|
358
|
+
# Default stream_limit
|
|
359
|
+
#
|
|
360
|
+
# source://http-2-next//lib/http/2/next/connection.rb#11
|
|
361
|
+
HTTP2Next::DEFAULT_MAX_CONCURRENT_STREAMS = T.let(T.unsafe(nil), Integer)
|
|
362
|
+
|
|
363
|
+
# Default stream priority (lower values are higher priority).
|
|
364
|
+
#
|
|
365
|
+
# source://http-2-next//lib/http/2/next/connection.rb#33
|
|
366
|
+
HTTP2Next::DEFAULT_WEIGHT = T.let(T.unsafe(nil), Integer)
|
|
367
|
+
|
|
368
|
+
# Basic event emitter implementation with support for persistent and
|
|
369
|
+
# one-time event callbacks.
|
|
370
|
+
#
|
|
371
|
+
# source://http-2-next//lib/http/2/next/emitter.rb#7
|
|
372
|
+
module HTTP2Next::Emitter
|
|
373
|
+
# Emit event with provided arguments.
|
|
374
|
+
#
|
|
375
|
+
# @param event [Symbol]
|
|
376
|
+
# @param args [Array] arguments to be passed to the callbacks
|
|
377
|
+
# @param block [Proc] callback function
|
|
378
|
+
#
|
|
379
|
+
# source://http-2-next//lib/http/2/next/emitter.rb#34
|
|
380
|
+
def emit(event, *args, &block); end
|
|
381
|
+
|
|
382
|
+
# Subscribe to all future events for specified type.
|
|
383
|
+
#
|
|
384
|
+
# @param event [Symbol]
|
|
385
|
+
# @param block [Proc] callback function
|
|
386
|
+
# @raise [ArgumentError]
|
|
387
|
+
#
|
|
388
|
+
# source://http-2-next//lib/http/2/next/emitter.rb#12
|
|
389
|
+
def on(event, &block); end
|
|
390
|
+
|
|
391
|
+
# Subscribe to next event (at most once) for specified type.
|
|
392
|
+
#
|
|
393
|
+
# @param event [Symbol]
|
|
394
|
+
# @param block [Proc] callback function
|
|
395
|
+
#
|
|
396
|
+
# source://http-2-next//lib/http/2/next/emitter.rb#22
|
|
397
|
+
def once(event, &block); end
|
|
398
|
+
|
|
399
|
+
private
|
|
400
|
+
|
|
401
|
+
# source://http-2-next//lib/http/2/next/emitter.rb#42
|
|
402
|
+
def listeners(event); end
|
|
403
|
+
end
|
|
404
|
+
|
|
405
|
+
# Stream, connection, and compressor exceptions.
|
|
406
|
+
#
|
|
407
|
+
# source://http-2-next//lib/http/2/next/error.rb#5
|
|
408
|
+
module HTTP2Next::Error
|
|
409
|
+
class << self
|
|
410
|
+
# Returns the value of attribute types.
|
|
411
|
+
#
|
|
412
|
+
# source://http-2-next//lib/http/2/next/error.rb#9
|
|
413
|
+
def types; end
|
|
414
|
+
end
|
|
415
|
+
end
|
|
416
|
+
|
|
417
|
+
# Raised on any header encoding / decoding exception.
|
|
418
|
+
#
|
|
419
|
+
# @see ProtocolError
|
|
420
|
+
#
|
|
421
|
+
# source://http-2-next//lib/http/2/next/error.rb#38
|
|
422
|
+
class HTTP2Next::Error::CompressionError < ::HTTP2Next::Error::ProtocolError; end
|
|
423
|
+
|
|
424
|
+
# Raised if connection has been closed (or draining) and new stream
|
|
425
|
+
# cannot be opened.
|
|
426
|
+
#
|
|
427
|
+
# source://http-2-next//lib/http/2/next/error.rb#58
|
|
428
|
+
class HTTP2Next::Error::ConnectionClosed < ::HTTP2Next::Error::Error; end
|
|
429
|
+
|
|
430
|
+
# source://http-2-next//lib/http/2/next/error.rb#12
|
|
431
|
+
class HTTP2Next::Error::Error < ::StandardError
|
|
432
|
+
class << self
|
|
433
|
+
# @private
|
|
434
|
+
#
|
|
435
|
+
# source://http-2-next//lib/http/2/next/error.rb#13
|
|
436
|
+
def inherited(klass); end
|
|
437
|
+
end
|
|
438
|
+
end
|
|
439
|
+
|
|
440
|
+
# Raised on invalid flow control frame or command.
|
|
441
|
+
#
|
|
442
|
+
# @see ProtocolError
|
|
443
|
+
#
|
|
444
|
+
# source://http-2-next//lib/http/2/next/error.rb#43
|
|
445
|
+
class HTTP2Next::Error::FlowControlError < ::HTTP2Next::Error::ProtocolError; end
|
|
446
|
+
|
|
447
|
+
# source://http-2-next//lib/http/2/next/error.rb#63
|
|
448
|
+
class HTTP2Next::Error::FrameSizeError < ::HTTP2Next::Error::Error; end
|
|
449
|
+
|
|
450
|
+
# Raised if connection header is missing or invalid indicating that
|
|
451
|
+
# this is an invalid HTTP 2.0 request - no frames are emitted and the
|
|
452
|
+
# connection must be aborted.
|
|
453
|
+
#
|
|
454
|
+
# source://http-2-next//lib/http/2/next/error.rb#28
|
|
455
|
+
class HTTP2Next::Error::HandshakeError < ::HTTP2Next::Error::Error; end
|
|
456
|
+
|
|
457
|
+
# Raised on invalid stream processing: invalid frame type received or
|
|
458
|
+
# sent, or invalid command issued.
|
|
459
|
+
#
|
|
460
|
+
# source://http-2-next//lib/http/2/next/error.rb#47
|
|
461
|
+
class HTTP2Next::Error::InternalError < ::HTTP2Next::Error::ProtocolError; end
|
|
462
|
+
|
|
463
|
+
# Raised by stream or connection handlers, results in GOAWAY frame
|
|
464
|
+
# which signals termination of the current connection. You *cannot*
|
|
465
|
+
# recover from this exception, or any exceptions subclassed from it.
|
|
466
|
+
#
|
|
467
|
+
# source://http-2-next//lib/http/2/next/error.rb#33
|
|
468
|
+
class HTTP2Next::Error::ProtocolError < ::HTTP2Next::Error::Error; end
|
|
469
|
+
|
|
470
|
+
# Raised if stream has been closed and new frames cannot be sent.
|
|
471
|
+
#
|
|
472
|
+
# source://http-2-next//lib/http/2/next/error.rb#54
|
|
473
|
+
class HTTP2Next::Error::StreamClosed < ::HTTP2Next::Error::Error; end
|
|
474
|
+
|
|
475
|
+
# Raised if stream limit has been reached and new stream cannot be opened.
|
|
476
|
+
#
|
|
477
|
+
# source://http-2-next//lib/http/2/next/error.rb#61
|
|
478
|
+
class HTTP2Next::Error::StreamLimitExceeded < ::HTTP2Next::Error::Error; end
|
|
479
|
+
|
|
480
|
+
# Implementation of stream and connection DATA flow control: frames may
|
|
481
|
+
# be split and / or may be buffered based on current flow control window.
|
|
482
|
+
#
|
|
483
|
+
# source://http-2-next//lib/http/2/next/flow_buffer.rb#7
|
|
484
|
+
module HTTP2Next::FlowBuffer
|
|
485
|
+
include ::HTTP2Next::Error
|
|
486
|
+
|
|
487
|
+
# Amount of buffered data. Only DATA payloads are subject to flow stream
|
|
488
|
+
# and connection flow control.
|
|
489
|
+
#
|
|
490
|
+
# @return [Integer]
|
|
491
|
+
#
|
|
492
|
+
# source://http-2-next//lib/http/2/next/flow_buffer.rb#16
|
|
493
|
+
def buffered_amount; end
|
|
494
|
+
|
|
495
|
+
# source://http-2-next//lib/http/2/next/flow_buffer.rb#20
|
|
496
|
+
def flush; end
|
|
497
|
+
|
|
498
|
+
private
|
|
499
|
+
|
|
500
|
+
# source://http-2-next//lib/http/2/next/flow_buffer.rb#36
|
|
501
|
+
def calculate_window_update(window_max_size); end
|
|
502
|
+
|
|
503
|
+
# source://http-2-next//lib/http/2/next/flow_buffer.rb#90
|
|
504
|
+
def process_window_update(frame:, encode: T.unsafe(nil)); end
|
|
505
|
+
|
|
506
|
+
# source://http-2-next//lib/http/2/next/flow_buffer.rb#26
|
|
507
|
+
def send_buffer; end
|
|
508
|
+
|
|
509
|
+
# Buffers outgoing DATA frames and applies flow control logic to split
|
|
510
|
+
# and emit DATA frames based on current flow control window. If the
|
|
511
|
+
# window is large enough, the data is sent immediately. Otherwise, the
|
|
512
|
+
# data is buffered until the flow control window is updated.
|
|
513
|
+
#
|
|
514
|
+
# Buffered DATA frames are emitted in FIFO order.
|
|
515
|
+
#
|
|
516
|
+
# @param frame [Hash]
|
|
517
|
+
# @param encode [Boolean] set to true by connection
|
|
518
|
+
#
|
|
519
|
+
# source://http-2-next//lib/http/2/next/flow_buffer.rb#71
|
|
520
|
+
def send_data(frame = T.unsafe(nil), encode = T.unsafe(nil)); end
|
|
521
|
+
|
|
522
|
+
# source://http-2-next//lib/http/2/next/flow_buffer.rb#30
|
|
523
|
+
def update_local_window(frame); end
|
|
524
|
+
end
|
|
525
|
+
|
|
526
|
+
# source://http-2-next//lib/http/2/next/flow_buffer.rb#10
|
|
527
|
+
HTTP2Next::FlowBuffer::MAX_WINDOW_SIZE = T.let(T.unsafe(nil), Integer)
|
|
528
|
+
|
|
529
|
+
# source://http-2-next//lib/http/2/next/flow_buffer.rb#103
|
|
530
|
+
class HTTP2Next::FrameBuffer
|
|
531
|
+
# @return [FrameBuffer] a new instance of FrameBuffer
|
|
532
|
+
#
|
|
533
|
+
# source://http-2-next//lib/http/2/next/flow_buffer.rb#106
|
|
534
|
+
def initialize; end
|
|
535
|
+
|
|
536
|
+
# source://http-2-next//lib/http/2/next/flow_buffer.rb#111
|
|
537
|
+
def <<(frame); end
|
|
538
|
+
|
|
539
|
+
# Returns the value of attribute bytesize.
|
|
540
|
+
#
|
|
541
|
+
# source://http-2-next//lib/http/2/next/flow_buffer.rb#104
|
|
542
|
+
def bytesize; end
|
|
543
|
+
|
|
544
|
+
# @return [Boolean]
|
|
545
|
+
#
|
|
546
|
+
# source://http-2-next//lib/http/2/next/flow_buffer.rb#116
|
|
547
|
+
def empty?; end
|
|
548
|
+
|
|
549
|
+
# source://http-2-next//lib/http/2/next/flow_buffer.rb#120
|
|
550
|
+
def retrieve(window_size); end
|
|
551
|
+
end
|
|
552
|
+
|
|
553
|
+
# Performs encoding, decoding, and validation of binary HTTP/2 frames.
|
|
554
|
+
#
|
|
555
|
+
# source://http-2-next//lib/http/2/next/framer.rb#6
|
|
556
|
+
class HTTP2Next::Framer
|
|
557
|
+
include ::HTTP2Next::Error
|
|
558
|
+
|
|
559
|
+
# Initializes new framer object.
|
|
560
|
+
#
|
|
561
|
+
# @return [Framer] a new instance of Framer
|
|
562
|
+
#
|
|
563
|
+
# source://http-2-next//lib/http/2/next/framer.rb#116
|
|
564
|
+
def initialize(local_max_frame_size = T.unsafe(nil), remote_max_frame_size = T.unsafe(nil)); end
|
|
565
|
+
|
|
566
|
+
# Generates common 9-byte frame header.
|
|
567
|
+
# - http://tools.ietf.org/html/draft-ietf-httpbis-http2-16#section-4.1
|
|
568
|
+
#
|
|
569
|
+
# @param frame [Hash]
|
|
570
|
+
# @raise [CompressionError]
|
|
571
|
+
# @return [String]
|
|
572
|
+
#
|
|
573
|
+
# source://http-2-next//lib/http/2/next/framer.rb#127
|
|
574
|
+
def common_header(frame); end
|
|
575
|
+
|
|
576
|
+
# Generates encoded HTTP/2 frame.
|
|
577
|
+
# - http://tools.ietf.org/html/draft-ietf-httpbis-http2
|
|
578
|
+
#
|
|
579
|
+
# @param frame [Hash]
|
|
580
|
+
#
|
|
581
|
+
# source://http-2-next//lib/http/2/next/framer.rb#180
|
|
582
|
+
def generate(frame); end
|
|
583
|
+
|
|
584
|
+
# maximum frame size
|
|
585
|
+
#
|
|
586
|
+
# source://http-2-next//lib/http/2/next/framer.rb#15
|
|
587
|
+
def local_max_frame_size; end
|
|
588
|
+
|
|
589
|
+
# maximum frame size
|
|
590
|
+
#
|
|
591
|
+
# source://http-2-next//lib/http/2/next/framer.rb#15
|
|
592
|
+
def local_max_frame_size=(_arg0); end
|
|
593
|
+
|
|
594
|
+
# Decodes complete HTTP/2 frame from provided buffer. If the buffer
|
|
595
|
+
# does not contain enough data, no further work is performed.
|
|
596
|
+
#
|
|
597
|
+
# @param buf [Buffer]
|
|
598
|
+
# @raise [ProtocolError]
|
|
599
|
+
#
|
|
600
|
+
# source://http-2-next//lib/http/2/next/framer.rb#339
|
|
601
|
+
def parse(buf); end
|
|
602
|
+
|
|
603
|
+
# Decodes common 9-byte header.
|
|
604
|
+
#
|
|
605
|
+
# @param buf [Buffer]
|
|
606
|
+
# @return [Hash] the corresponding frame
|
|
607
|
+
#
|
|
608
|
+
# source://http-2-next//lib/http/2/next/framer.rb#160
|
|
609
|
+
def read_common_header(buf); end
|
|
610
|
+
|
|
611
|
+
# maximum frame size
|
|
612
|
+
#
|
|
613
|
+
# source://http-2-next//lib/http/2/next/framer.rb#15
|
|
614
|
+
def remote_max_frame_size; end
|
|
615
|
+
|
|
616
|
+
# maximum frame size
|
|
617
|
+
#
|
|
618
|
+
# source://http-2-next//lib/http/2/next/framer.rb#15
|
|
619
|
+
def remote_max_frame_size=(_arg0); end
|
|
620
|
+
|
|
621
|
+
private
|
|
622
|
+
|
|
623
|
+
# source://http-2-next//lib/http/2/next/framer.rb#459
|
|
624
|
+
def pack_error(error); end
|
|
625
|
+
|
|
626
|
+
# source://http-2-next//lib/http/2/next/framer.rb#469
|
|
627
|
+
def unpack_error(error); end
|
|
628
|
+
end
|
|
629
|
+
|
|
630
|
+
# Default value of max frame size (16384 bytes)
|
|
631
|
+
#
|
|
632
|
+
# source://http-2-next//lib/http/2/next/framer.rb#12
|
|
633
|
+
HTTP2Next::Framer::DEFAULT_MAX_FRAME_SIZE = T.let(T.unsafe(nil), Integer)
|
|
634
|
+
|
|
635
|
+
# Default error types as defined by the spec
|
|
636
|
+
#
|
|
637
|
+
# source://http-2-next//lib/http/2/next/framer.rb#85
|
|
638
|
+
HTTP2Next::Framer::DEFINED_ERRORS = T.let(T.unsafe(nil), Hash)
|
|
639
|
+
|
|
640
|
+
# Default settings as defined by the spec
|
|
641
|
+
#
|
|
642
|
+
# source://http-2-next//lib/http/2/next/framer.rb#75
|
|
643
|
+
HTTP2Next::Framer::DEFINED_SETTINGS = T.let(T.unsafe(nil), Hash)
|
|
644
|
+
|
|
645
|
+
# source://http-2-next//lib/http/2/next/framer.rb#104
|
|
646
|
+
HTTP2Next::Framer::EBIT = T.let(T.unsafe(nil), Integer)
|
|
647
|
+
|
|
648
|
+
# Per frame flags as defined by the spec
|
|
649
|
+
#
|
|
650
|
+
# source://http-2-next//lib/http/2/next/framer.rb#42
|
|
651
|
+
HTTP2Next::Framer::FRAME_FLAGS = T.let(T.unsafe(nil), Hash)
|
|
652
|
+
|
|
653
|
+
# source://http-2-next//lib/http/2/next/framer.rb#109
|
|
654
|
+
HTTP2Next::Framer::FRAME_LENGTH_HISHIFT = T.let(T.unsafe(nil), Integer)
|
|
655
|
+
|
|
656
|
+
# source://http-2-next//lib/http/2/next/framer.rb#110
|
|
657
|
+
HTTP2Next::Framer::FRAME_LENGTH_LOMASK = T.let(T.unsafe(nil), Integer)
|
|
658
|
+
|
|
659
|
+
# HTTP/2 frame type mapping as defined by the spec
|
|
660
|
+
#
|
|
661
|
+
# source://http-2-next//lib/http/2/next/framer.rb#24
|
|
662
|
+
HTTP2Next::Framer::FRAME_TYPES = T.let(T.unsafe(nil), Hash)
|
|
663
|
+
|
|
664
|
+
# source://http-2-next//lib/http/2/next/framer.rb#39
|
|
665
|
+
HTTP2Next::Framer::FRAME_TYPES_WITH_PADDING = T.let(T.unsafe(nil), Array)
|
|
666
|
+
|
|
667
|
+
# source://http-2-next//lib/http/2/next/framer.rb#108
|
|
668
|
+
HTTP2Next::Framer::HEADERPACK = T.let(T.unsafe(nil), String)
|
|
669
|
+
|
|
670
|
+
# Maximum stream ID (2^31)
|
|
671
|
+
#
|
|
672
|
+
# source://http-2-next//lib/http/2/next/framer.rb#18
|
|
673
|
+
HTTP2Next::Framer::MAX_STREAM_ID = T.let(T.unsafe(nil), Integer)
|
|
674
|
+
|
|
675
|
+
# Maximum window increment value (2^31)
|
|
676
|
+
#
|
|
677
|
+
# source://http-2-next//lib/http/2/next/framer.rb#21
|
|
678
|
+
HTTP2Next::Framer::MAX_WINDOWINC = T.let(T.unsafe(nil), Integer)
|
|
679
|
+
|
|
680
|
+
# source://http-2-next//lib/http/2/next/framer.rb#102
|
|
681
|
+
HTTP2Next::Framer::RBIT = T.let(T.unsafe(nil), Integer)
|
|
682
|
+
|
|
683
|
+
# source://http-2-next//lib/http/2/next/framer.rb#103
|
|
684
|
+
HTTP2Next::Framer::RBYTE = T.let(T.unsafe(nil), Integer)
|
|
685
|
+
|
|
686
|
+
# source://http-2-next//lib/http/2/next/framer.rb#106
|
|
687
|
+
HTTP2Next::Framer::UINT16 = T.let(T.unsafe(nil), String)
|
|
688
|
+
|
|
689
|
+
# source://http-2-next//lib/http/2/next/framer.rb#105
|
|
690
|
+
HTTP2Next::Framer::UINT32 = T.let(T.unsafe(nil), String)
|
|
691
|
+
|
|
692
|
+
# source://http-2-next//lib/http/2/next/framer.rb#107
|
|
693
|
+
HTTP2Next::Framer::UINT8 = T.let(T.unsafe(nil), String)
|
|
694
|
+
|
|
695
|
+
# Implementation of header compression for HTTP 2.0 (HPACK) format adapted
|
|
696
|
+
# to efficiently represent HTTP headers in the context of HTTP 2.0.
|
|
697
|
+
#
|
|
698
|
+
# - http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-10
|
|
699
|
+
#
|
|
700
|
+
# source://http-2-next//lib/http/2/next/header.rb#8
|
|
701
|
+
module HTTP2Next::Header; end
|
|
702
|
+
|
|
703
|
+
# Responsible for encoding header key-value pairs using HPACK algorithm.
|
|
704
|
+
#
|
|
705
|
+
# source://http-2-next//lib/http/2/next/header/compressor.rb#6
|
|
706
|
+
class HTTP2Next::Header::Compressor
|
|
707
|
+
# @param options [Hash] encoding options
|
|
708
|
+
# @return [Compressor] a new instance of Compressor
|
|
709
|
+
#
|
|
710
|
+
# source://http-2-next//lib/http/2/next/header/compressor.rb#8
|
|
711
|
+
def initialize(options = T.unsafe(nil)); end
|
|
712
|
+
|
|
713
|
+
# Encodes provided list of HTTP headers.
|
|
714
|
+
#
|
|
715
|
+
# @param headers [Array] +[[name, value], ...]+
|
|
716
|
+
# @return [Buffer]
|
|
717
|
+
#
|
|
718
|
+
# source://http-2-next//lib/http/2/next/header/compressor.rb#124
|
|
719
|
+
def encode(headers); end
|
|
720
|
+
|
|
721
|
+
# Encodes header command with appropriate header representation.
|
|
722
|
+
#
|
|
723
|
+
# @param h [Hash] header command
|
|
724
|
+
# @param buffer [String]
|
|
725
|
+
# @return [Buffer]
|
|
726
|
+
#
|
|
727
|
+
# source://http-2-next//lib/http/2/next/header/compressor.rb#94
|
|
728
|
+
def header(h, buffer = T.unsafe(nil)); end
|
|
729
|
+
|
|
730
|
+
# Encodes provided value via integer representation.
|
|
731
|
+
# - http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-10#section-5.1
|
|
732
|
+
#
|
|
733
|
+
# If I < 2^N - 1, encode I on N bits
|
|
734
|
+
# Else
|
|
735
|
+
# encode 2^N - 1 on N bits
|
|
736
|
+
# I = I - (2^N - 1)
|
|
737
|
+
# While I >= 128
|
|
738
|
+
# Encode (I % 128 + 128) on 8 bits
|
|
739
|
+
# I = I / 128
|
|
740
|
+
# encode (I) on 8 bits
|
|
741
|
+
#
|
|
742
|
+
# @param i [Integer] value to encode
|
|
743
|
+
# @param n [Integer] number of available bits
|
|
744
|
+
# @return [String] binary string
|
|
745
|
+
#
|
|
746
|
+
# source://http-2-next//lib/http/2/next/header/compressor.rb#33
|
|
747
|
+
def integer(i, n); end
|
|
748
|
+
|
|
749
|
+
# Encodes provided value via string literal representation.
|
|
750
|
+
# - http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-10#section-5.2
|
|
751
|
+
#
|
|
752
|
+
# * The string length, defined as the number of bytes needed to store
|
|
753
|
+
# its UTF-8 representation, is represented as an integer with a seven
|
|
754
|
+
# bits prefix. If the string length is strictly less than 127, it is
|
|
755
|
+
# represented as one byte.
|
|
756
|
+
# * If the bit 7 of the first byte is 1, the string value is represented
|
|
757
|
+
# as a list of Huffman encoded octets
|
|
758
|
+
# (padded with bit 1's until next octet boundary).
|
|
759
|
+
# * If the bit 7 of the first byte is 0, the string value is
|
|
760
|
+
# represented as a list of UTF-8 encoded octets.
|
|
761
|
+
#
|
|
762
|
+
# :never Do not use Huffman encoding
|
|
763
|
+
# :always Always use Huffman encoding
|
|
764
|
+
# :shorter Use Huffman when the result is strictly shorter
|
|
765
|
+
#
|
|
766
|
+
# @param str [String]
|
|
767
|
+
# @return [String] binary string
|
|
768
|
+
#
|
|
769
|
+
# source://http-2-next//lib/http/2/next/header/compressor.rb#70
|
|
770
|
+
def string(str); end
|
|
771
|
+
|
|
772
|
+
# Set dynamic table size in EncodingContext
|
|
773
|
+
#
|
|
774
|
+
# @param size [Integer] new dynamic table size
|
|
775
|
+
#
|
|
776
|
+
# source://http-2-next//lib/http/2/next/header/compressor.rb#14
|
|
777
|
+
def table_size=(size); end
|
|
778
|
+
end
|
|
779
|
+
|
|
780
|
+
# Responsible for decoding received headers and maintaining compression
|
|
781
|
+
# context of the opposing peer. Decompressor must be initialized with
|
|
782
|
+
# appropriate starting context based on local role: client or server.
|
|
783
|
+
#
|
|
784
|
+
# @example
|
|
785
|
+
# server_role = Decompressor.new(:request)
|
|
786
|
+
# client_role = Decompressor.new(:response)
|
|
787
|
+
#
|
|
788
|
+
# source://http-2-next//lib/http/2/next/header/decompressor.rb#13
|
|
789
|
+
class HTTP2Next::Header::Decompressor
|
|
790
|
+
include ::HTTP2Next::Error
|
|
791
|
+
|
|
792
|
+
# @param options [Hash] decoding options. Only :table_size is effective.
|
|
793
|
+
# @return [Decompressor] a new instance of Decompressor
|
|
794
|
+
#
|
|
795
|
+
# source://http-2-next//lib/http/2/next/header/decompressor.rb#17
|
|
796
|
+
def initialize(options = T.unsafe(nil)); end
|
|
797
|
+
|
|
798
|
+
# Decodes and processes header commands within provided buffer.
|
|
799
|
+
#
|
|
800
|
+
# @param buf [Buffer]
|
|
801
|
+
# @param frame [HTTP2Next::Frame, nil]
|
|
802
|
+
# @return [Array] +[[name, value], ...]
|
|
803
|
+
#
|
|
804
|
+
# source://http-2-next//lib/http/2/next/header/decompressor.rb#109
|
|
805
|
+
def decode(buf, frame = T.unsafe(nil)); end
|
|
806
|
+
|
|
807
|
+
# Decodes header command from provided buffer.
|
|
808
|
+
#
|
|
809
|
+
# @param buf [Buffer]
|
|
810
|
+
# @raise [CompressionError]
|
|
811
|
+
# @return [Hash] command
|
|
812
|
+
#
|
|
813
|
+
# source://http-2-next//lib/http/2/next/header/decompressor.rb#70
|
|
814
|
+
def header(buf); end
|
|
815
|
+
|
|
816
|
+
# Decodes integer value from provided buffer.
|
|
817
|
+
#
|
|
818
|
+
# @param buf [String]
|
|
819
|
+
# @param n [Integer] number of available bits
|
|
820
|
+
# @return [Integer]
|
|
821
|
+
#
|
|
822
|
+
# source://http-2-next//lib/http/2/next/header/decompressor.rb#32
|
|
823
|
+
def integer(buf, n); end
|
|
824
|
+
|
|
825
|
+
# Decodes string value from provided buffer.
|
|
826
|
+
#
|
|
827
|
+
# @param buf [String]
|
|
828
|
+
# @raise [CompressionError] when input is malformed
|
|
829
|
+
# @return [String] UTF-8 encoded string
|
|
830
|
+
#
|
|
831
|
+
# source://http-2-next//lib/http/2/next/header/decompressor.rb#54
|
|
832
|
+
def string(buf); end
|
|
833
|
+
|
|
834
|
+
# Set dynamic table size in EncodingContext
|
|
835
|
+
#
|
|
836
|
+
# @param size [Integer] new dynamic table size
|
|
837
|
+
#
|
|
838
|
+
# source://http-2-next//lib/http/2/next/header/decompressor.rb#23
|
|
839
|
+
def table_size=(size); end
|
|
840
|
+
end
|
|
841
|
+
|
|
842
|
+
# source://http-2-next//lib/http/2/next/header/decompressor.rb#102
|
|
843
|
+
HTTP2Next::Header::Decompressor::FORBIDDEN_HEADERS = T.let(T.unsafe(nil), Array)
|
|
844
|
+
|
|
845
|
+
# source://http-2-next//lib/http/2/next/header/encoding_context.rb#8
|
|
846
|
+
class HTTP2Next::Header::EncodingContext
|
|
847
|
+
include ::HTTP2Next::Error
|
|
848
|
+
|
|
849
|
+
# Initializes compression context with appropriate client/server
|
|
850
|
+
# defaults and maximum size of the dynamic table.
|
|
851
|
+
#
|
|
852
|
+
# @param options [Hash] encoding options
|
|
853
|
+
# :table_size Integer maximum dynamic table size in bytes
|
|
854
|
+
# :huffman Symbol :always, :never, :shorter
|
|
855
|
+
# :index Symbol :all, :static, :never
|
|
856
|
+
# @return [EncodingContext] a new instance of EncodingContext
|
|
857
|
+
#
|
|
858
|
+
# source://http-2-next//lib/http/2/next/header/encoding_context.rb#106
|
|
859
|
+
def initialize(options = T.unsafe(nil)); end
|
|
860
|
+
|
|
861
|
+
# Emits command for a header.
|
|
862
|
+
# Prefer static table over dynamic table.
|
|
863
|
+
# Prefer exact match over name-only match.
|
|
864
|
+
#
|
|
865
|
+
# +@options [:index]+ controls whether to use the dynamic table,
|
|
866
|
+
# static table, or both.
|
|
867
|
+
# :never Do not use dynamic table or static table reference at all.
|
|
868
|
+
# :static Use static table only.
|
|
869
|
+
# :all Use all of them.
|
|
870
|
+
#
|
|
871
|
+
# @param header [Array] +[name, value]+
|
|
872
|
+
# @return [Hash] command
|
|
873
|
+
#
|
|
874
|
+
# source://http-2-next//lib/http/2/next/header/encoding_context.rb#250
|
|
875
|
+
def addcmd(*header); end
|
|
876
|
+
|
|
877
|
+
# Returns current table size in octets
|
|
878
|
+
#
|
|
879
|
+
# @return [Integer]
|
|
880
|
+
#
|
|
881
|
+
# source://http-2-next//lib/http/2/next/header/encoding_context.rb#295
|
|
882
|
+
def current_table_size; end
|
|
883
|
+
|
|
884
|
+
# Finds an entry in current dynamic table by index.
|
|
885
|
+
# Note that index is zero-based in this module.
|
|
886
|
+
#
|
|
887
|
+
# If the index is greater than the last index in the static table,
|
|
888
|
+
# an entry in the dynamic table is dereferenced.
|
|
889
|
+
#
|
|
890
|
+
# If the index is greater than the last header index, an error is raised.
|
|
891
|
+
#
|
|
892
|
+
# @param index [Integer] zero-based index in the dynamic table.
|
|
893
|
+
# @raise [CompressionError]
|
|
894
|
+
# @return [Array] +[key, value]+
|
|
895
|
+
#
|
|
896
|
+
# source://http-2-next//lib/http/2/next/header/encoding_context.rb#141
|
|
897
|
+
def dereference(index); end
|
|
898
|
+
|
|
899
|
+
# Duplicates current compression context
|
|
900
|
+
#
|
|
901
|
+
# @return [EncodingContext]
|
|
902
|
+
#
|
|
903
|
+
# source://http-2-next//lib/http/2/next/header/encoding_context.rb#120
|
|
904
|
+
def dup; end
|
|
905
|
+
|
|
906
|
+
# Plan header compression according to +@options [:index]+
|
|
907
|
+
# :never Do not use dynamic table or static table reference at all.
|
|
908
|
+
# :static Use static table only.
|
|
909
|
+
# :all Use all of them.
|
|
910
|
+
#
|
|
911
|
+
# @param headers [Array] +[[name, value], ...]+
|
|
912
|
+
# @return [Array] array of commands
|
|
913
|
+
#
|
|
914
|
+
# source://http-2-next//lib/http/2/next/header/encoding_context.rb#221
|
|
915
|
+
def encode(headers); end
|
|
916
|
+
|
|
917
|
+
# source://http-2-next//lib/http/2/next/header/encoding_context.rb#299
|
|
918
|
+
def listen_on_table; end
|
|
919
|
+
|
|
920
|
+
# Current encoding options
|
|
921
|
+
#
|
|
922
|
+
# :table_size Integer maximum dynamic table size in bytes
|
|
923
|
+
# :huffman Symbol :always, :never, :shorter
|
|
924
|
+
# :index Symbol :all, :static, :never
|
|
925
|
+
#
|
|
926
|
+
# source://http-2-next//lib/http/2/next/header/encoding_context.rb#97
|
|
927
|
+
def options; end
|
|
928
|
+
|
|
929
|
+
# Header Block Processing
|
|
930
|
+
# - http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-10#section-4.1
|
|
931
|
+
#
|
|
932
|
+
# @param cmd [Hash] { type:, name:, value:, index: }
|
|
933
|
+
# @return [Array, nil] +[name, value]+ header field that is added to the decoded header list,
|
|
934
|
+
# or nil if +cmd[:type]+ is +:changetablesize+
|
|
935
|
+
#
|
|
936
|
+
# source://http-2-next//lib/http/2/next/header/encoding_context.rb#155
|
|
937
|
+
def process(cmd); end
|
|
938
|
+
|
|
939
|
+
# Current table of header key-value pairs.
|
|
940
|
+
#
|
|
941
|
+
# source://http-2-next//lib/http/2/next/header/encoding_context.rb#90
|
|
942
|
+
def table; end
|
|
943
|
+
|
|
944
|
+
# Alter dynamic table size.
|
|
945
|
+
# When the size is reduced, some headers might be evicted.
|
|
946
|
+
#
|
|
947
|
+
# source://http-2-next//lib/http/2/next/header/encoding_context.rb#288
|
|
948
|
+
def table_size=(size); end
|
|
949
|
+
|
|
950
|
+
private
|
|
951
|
+
|
|
952
|
+
# Add a name-value pair to the dynamic table.
|
|
953
|
+
# Older entries might have been evicted so that
|
|
954
|
+
# the new entry fits in the dynamic table.
|
|
955
|
+
#
|
|
956
|
+
# @param cmd [Array] +[name, value]+
|
|
957
|
+
#
|
|
958
|
+
# source://http-2-next//lib/http/2/next/header/encoding_context.rb#312
|
|
959
|
+
def add_to_table(cmd); end
|
|
960
|
+
|
|
961
|
+
# To keep the dynamic table size lower than or equal to @limit,
|
|
962
|
+
# remove one or more entries at the end of the dynamic table.
|
|
963
|
+
#
|
|
964
|
+
# @param cmd [Hash]
|
|
965
|
+
# @return [Boolean] whether +cmd+ fits in the dynamic table.
|
|
966
|
+
#
|
|
967
|
+
# source://http-2-next//lib/http/2/next/header/encoding_context.rb#324
|
|
968
|
+
def size_check(cmd); end
|
|
969
|
+
end
|
|
970
|
+
|
|
971
|
+
# Static table
|
|
972
|
+
# - http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-10#appendix-A
|
|
973
|
+
#
|
|
974
|
+
# @private
|
|
975
|
+
#
|
|
976
|
+
# source://http-2-next//lib/http/2/next/header/encoding_context.rb#18
|
|
977
|
+
HTTP2Next::Header::EncodingContext::STATIC_TABLE = T.let(T.unsafe(nil), Array)
|
|
978
|
+
|
|
979
|
+
# source://http-2-next//lib/http/2/next/header/encoding_context.rb#82
|
|
980
|
+
HTTP2Next::Header::EncodingContext::STATIC_TABLE_BY_FIELD = T.let(T.unsafe(nil), Hash)
|
|
981
|
+
|
|
982
|
+
# source://http-2-next//lib/http/2/next/header/encoding_context.rb#87
|
|
983
|
+
HTTP2Next::Header::EncodingContext::STATIC_TABLE_SIZE = T.let(T.unsafe(nil), Integer)
|
|
984
|
+
|
|
985
|
+
# source://http-2-next//lib/http/2/next/header/encoding_context.rb#13
|
|
986
|
+
HTTP2Next::Header::EncodingContext::UPPER = T.let(T.unsafe(nil), Regexp)
|
|
987
|
+
|
|
988
|
+
# Header representation as defined by the spec.
|
|
989
|
+
#
|
|
990
|
+
# source://http-2-next//lib/http/2/next/header.rb#10
|
|
991
|
+
HTTP2Next::Header::HEADREP = T.let(T.unsafe(nil), Hash)
|
|
992
|
+
|
|
993
|
+
# Huffman encoder/decoder
|
|
994
|
+
#
|
|
995
|
+
# source://http-2-next//lib/http/2/next/header/huffman.rb#12
|
|
996
|
+
class HTTP2Next::Header::Huffman
|
|
997
|
+
include ::HTTP2Next::Error
|
|
998
|
+
|
|
999
|
+
# Decodes provided Huffman coded string.
|
|
1000
|
+
#
|
|
1001
|
+
# @param buf [Buffer]
|
|
1002
|
+
# @raise [CompressionError] when Huffman coded string is malformed
|
|
1003
|
+
# @return [String] binary string
|
|
1004
|
+
#
|
|
1005
|
+
# source://http-2-next//lib/http/2/next/header/huffman.rb#37
|
|
1006
|
+
def decode(buf); end
|
|
1007
|
+
|
|
1008
|
+
# Encodes provided value via huffman encoding.
|
|
1009
|
+
# Length is not encoded in this method.
|
|
1010
|
+
#
|
|
1011
|
+
# @param str [String]
|
|
1012
|
+
# @return [String] binary string
|
|
1013
|
+
#
|
|
1014
|
+
# source://http-2-next//lib/http/2/next/header/huffman.rb#26
|
|
1015
|
+
def encode(str); end
|
|
1016
|
+
end
|
|
1017
|
+
|
|
1018
|
+
# source://http-2-next//lib/http/2/next/header/huffman.rb#17
|
|
1019
|
+
HTTP2Next::Header::Huffman::BITS_AT_ONCE = T.let(T.unsafe(nil), Integer)
|
|
1020
|
+
|
|
1021
|
+
# Huffman table as specified in
|
|
1022
|
+
# - http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-10#appendix-B
|
|
1023
|
+
#
|
|
1024
|
+
# source://http-2-next//lib/http/2/next/header/huffman.rb#65
|
|
1025
|
+
HTTP2Next::Header::Huffman::CODES = T.let(T.unsafe(nil), Array)
|
|
1026
|
+
|
|
1027
|
+
# source://http-2-next//lib/http/2/next/header/huffman.rb#325
|
|
1028
|
+
HTTP2Next::Header::Huffman::ENCODE_TABLE = T.let(T.unsafe(nil), Array)
|
|
1029
|
+
|
|
1030
|
+
# source://http-2-next//lib/http/2/next/header/huffman.rb#18
|
|
1031
|
+
HTTP2Next::Header::Huffman::EOS = T.let(T.unsafe(nil), Integer)
|
|
1032
|
+
|
|
1033
|
+
# source://http-2-next//lib/http/2/next/header/huffman_statemachine.rb#14
|
|
1034
|
+
HTTP2Next::Header::Huffman::MACHINE = T.let(T.unsafe(nil), Array)
|
|
1035
|
+
|
|
1036
|
+
# source://http-2-next//lib/http/2/next/header/huffman_statemachine.rb#13
|
|
1037
|
+
HTTP2Next::Header::Huffman::MAX_FINAL_STATE = T.let(T.unsafe(nil), Integer)
|
|
1038
|
+
|
|
1039
|
+
# source://http-2-next//lib/http/2/next/header.rb#21
|
|
1040
|
+
HTTP2Next::Header::LINEAR = T.let(T.unsafe(nil), Hash)
|
|
1041
|
+
|
|
1042
|
+
# source://http-2-next//lib/http/2/next/header.rb#25
|
|
1043
|
+
HTTP2Next::Header::LINEARH = T.let(T.unsafe(nil), Hash)
|
|
1044
|
+
|
|
1045
|
+
# Predefined options set for Compressor
|
|
1046
|
+
# http://mew.org/~kazu/material/2014-hpack.pdf
|
|
1047
|
+
#
|
|
1048
|
+
# source://http-2-next//lib/http/2/next/header.rb#20
|
|
1049
|
+
HTTP2Next::Header::NAIVE = T.let(T.unsafe(nil), Hash)
|
|
1050
|
+
|
|
1051
|
+
# source://http-2-next//lib/http/2/next/header.rb#24
|
|
1052
|
+
HTTP2Next::Header::NAIVEH = T.let(T.unsafe(nil), Hash)
|
|
1053
|
+
|
|
1054
|
+
# source://http-2-next//lib/http/2/next/header.rb#23
|
|
1055
|
+
HTTP2Next::Header::SHORTER = T.let(T.unsafe(nil), Hash)
|
|
1056
|
+
|
|
1057
|
+
# source://http-2-next//lib/http/2/next/header.rb#27
|
|
1058
|
+
HTTP2Next::Header::SHORTERH = T.let(T.unsafe(nil), Hash)
|
|
1059
|
+
|
|
1060
|
+
# source://http-2-next//lib/http/2/next/header.rb#22
|
|
1061
|
+
HTTP2Next::Header::STATIC = T.let(T.unsafe(nil), Hash)
|
|
1062
|
+
|
|
1063
|
+
# source://http-2-next//lib/http/2/next/header.rb#26
|
|
1064
|
+
HTTP2Next::Header::STATICH = T.let(T.unsafe(nil), Hash)
|
|
1065
|
+
|
|
1066
|
+
# source://http-2-next//lib/http/2/next/connection.rb#38
|
|
1067
|
+
HTTP2Next::REQUEST_MANDATORY_HEADERS = T.let(T.unsafe(nil), Array)
|
|
1068
|
+
|
|
1069
|
+
# source://http-2-next//lib/http/2/next/connection.rb#39
|
|
1070
|
+
HTTP2Next::RESPONSE_MANDATORY_HEADERS = T.let(T.unsafe(nil), Array)
|
|
1071
|
+
|
|
1072
|
+
# source://http-2-next//lib/http/2/next/extensions.rb#4
|
|
1073
|
+
module HTTP2Next::RegexpExtensions; end
|
|
1074
|
+
|
|
1075
|
+
# Default values for SETTINGS frame, as defined by the spec.
|
|
1076
|
+
#
|
|
1077
|
+
# source://http-2-next//lib/http/2/next/connection.rb#14
|
|
1078
|
+
HTTP2Next::SPEC_DEFAULT_CONNECTION_SETTINGS = T.let(T.unsafe(nil), Hash)
|
|
1079
|
+
|
|
1080
|
+
# HTTP 2.0 server connection class that implements appropriate header
|
|
1081
|
+
# compression / decompression algorithms and stream management logic.
|
|
1082
|
+
#
|
|
1083
|
+
# Your code is responsible for feeding request data to the server object,
|
|
1084
|
+
# which in turn performs all of the necessary HTTP 2.0 decoding / encoding,
|
|
1085
|
+
# state management, and the rest. A simple example:
|
|
1086
|
+
#
|
|
1087
|
+
# @example
|
|
1088
|
+
# socket = YourTransport.new
|
|
1089
|
+
#
|
|
1090
|
+
# conn = HTTP2Next::Server.new
|
|
1091
|
+
# conn.on(:stream) do |stream|
|
|
1092
|
+
# ...
|
|
1093
|
+
# end
|
|
1094
|
+
#
|
|
1095
|
+
# while bytes = socket.read
|
|
1096
|
+
# conn << bytes
|
|
1097
|
+
# end
|
|
1098
|
+
#
|
|
1099
|
+
# source://http-2-next//lib/http/2/next/server.rb#24
|
|
1100
|
+
class HTTP2Next::Server < ::HTTP2Next::Connection
|
|
1101
|
+
# Initialize new HTTP 2.0 server object.
|
|
1102
|
+
#
|
|
1103
|
+
# @return [Server] a new instance of Server
|
|
1104
|
+
#
|
|
1105
|
+
# source://http-2-next//lib/http/2/next/server.rb#28
|
|
1106
|
+
def initialize(settings = T.unsafe(nil)); end
|
|
1107
|
+
|
|
1108
|
+
# Returns the value of attribute origin_set.
|
|
1109
|
+
#
|
|
1110
|
+
# source://http-2-next//lib/http/2/next/server.rb#25
|
|
1111
|
+
def origin_set; end
|
|
1112
|
+
|
|
1113
|
+
# source://http-2-next//lib/http/2/next/server.rb#122
|
|
1114
|
+
def origin_set=(origins); end
|
|
1115
|
+
|
|
1116
|
+
# GET / HTTP/1.1
|
|
1117
|
+
# Host: server.example.com
|
|
1118
|
+
# Connection: Upgrade, HTTP2-Settings
|
|
1119
|
+
# Upgrade: h2c
|
|
1120
|
+
# HTTP2-Settings: <base64url encoding of HTTP/2 SETTINGS payload>
|
|
1121
|
+
#
|
|
1122
|
+
# Requests that contain a payload body MUST be sent in their entirety
|
|
1123
|
+
# before the client can send HTTP/2 frames. This means that a large
|
|
1124
|
+
# request can block the use of the connection until it is completely sent.
|
|
1125
|
+
#
|
|
1126
|
+
# If concurrency of an initial request with subsequent requests is
|
|
1127
|
+
# important, an OPTIONS request can be used to perform the upgrade to
|
|
1128
|
+
# HTTP/2, at the cost of an additional round trip.
|
|
1129
|
+
#
|
|
1130
|
+
# HTTP/1.1 101 Switching Protocols
|
|
1131
|
+
# Connection: Upgrade
|
|
1132
|
+
# Upgrade: h2c
|
|
1133
|
+
#
|
|
1134
|
+
# [ HTTP/2 connection ...
|
|
1135
|
+
#
|
|
1136
|
+
# - The first HTTP/2 frame sent by the server MUST be a server
|
|
1137
|
+
# connection preface (Section 3.5) consisting of a SETTINGS frame.
|
|
1138
|
+
# - Upon receiving the 101 response, the client MUST send a connection
|
|
1139
|
+
# preface (Section 3.5), which includes a SETTINGS frame.
|
|
1140
|
+
#
|
|
1141
|
+
# The HTTP/1.1 request that is sent prior to upgrade is assigned a stream
|
|
1142
|
+
# identifier of 1 (see Section 5.1.1) with default priority values
|
|
1143
|
+
# (Section 5.3.5). Stream 1 is implicitly "half-closed" from the client
|
|
1144
|
+
# toward the server (see Section 5.1), since the request is completed as
|
|
1145
|
+
# an HTTP/1.1 request. After commencing the HTTP/2 connection, stream 1
|
|
1146
|
+
# is used for the response.
|
|
1147
|
+
#
|
|
1148
|
+
# source://http-2-next//lib/http/2/next/server.rb#73
|
|
1149
|
+
def upgrade(settings, headers, body); end
|
|
1150
|
+
|
|
1151
|
+
private
|
|
1152
|
+
|
|
1153
|
+
# source://http-2-next//lib/http/2/next/server.rb#129
|
|
1154
|
+
def connection_settings(frame); end
|
|
1155
|
+
|
|
1156
|
+
# Handle locally initiated server-push event emitted by the stream.
|
|
1157
|
+
#
|
|
1158
|
+
# @param parent [Stream]
|
|
1159
|
+
# @param headers [Enumerable[String, String]]
|
|
1160
|
+
# @param flags [Array[Symbol]]
|
|
1161
|
+
# @param callback [Proc]
|
|
1162
|
+
# @yield [promise]
|
|
1163
|
+
#
|
|
1164
|
+
# source://http-2-next//lib/http/2/next/server.rb#146
|
|
1165
|
+
def promise(parent, headers, flags); end
|
|
1166
|
+
|
|
1167
|
+
# source://http-2-next//lib/http/2/next/server.rb#136
|
|
1168
|
+
def verify_pseudo_headers(frame); end
|
|
1169
|
+
end
|
|
1170
|
+
|
|
1171
|
+
# A single HTTP 2.0 connection can multiplex multiple streams in parallel:
|
|
1172
|
+
# multiple requests and responses can be in flight simultaneously and stream
|
|
1173
|
+
# data can be interleaved and prioritized.
|
|
1174
|
+
#
|
|
1175
|
+
# This class encapsulates all of the state, transition, flow-control, and
|
|
1176
|
+
# error management as defined by the HTTP 2.0 specification. All you have
|
|
1177
|
+
# to do is subscribe to appropriate events (marked with ":" prefix in
|
|
1178
|
+
# diagram below) and provide your application logic to handle request
|
|
1179
|
+
# and response processing.
|
|
1180
|
+
#
|
|
1181
|
+
# +--------+
|
|
1182
|
+
# PP | | PP
|
|
1183
|
+
# ,--------| idle |--------.
|
|
1184
|
+
# / | | \
|
|
1185
|
+
# v +--------+ v
|
|
1186
|
+
# +----------+ | +----------+
|
|
1187
|
+
# | | | H | |
|
|
1188
|
+
# ,---|:reserved | | |:reserved |---.
|
|
1189
|
+
# | | (local) | v | (remote) | |
|
|
1190
|
+
# | +----------+ +--------+ +----------+ |
|
|
1191
|
+
# | | :active | | :active | |
|
|
1192
|
+
# | | ,-------|:active |-------. | |
|
|
1193
|
+
# | | H / ES | | ES \ H | |
|
|
1194
|
+
# | v v +--------+ v v |
|
|
1195
|
+
# | +-----------+ | +-----------+ |
|
|
1196
|
+
# | |:half_close| | |:half_close| |
|
|
1197
|
+
# | | (remote) | | | (local) | |
|
|
1198
|
+
# | +-----------+ | +-----------+ |
|
|
1199
|
+
# | | v | |
|
|
1200
|
+
# | | ES/R +--------+ ES/R | |
|
|
1201
|
+
# | `----------->| |<-----------' |
|
|
1202
|
+
# | R | :close | R |
|
|
1203
|
+
# `-------------------->| |<--------------------'
|
|
1204
|
+
# +--------+
|
|
1205
|
+
#
|
|
1206
|
+
# source://http-2-next//lib/http/2/next/stream.rb#38
|
|
1207
|
+
class HTTP2Next::Stream
|
|
1208
|
+
include ::HTTP2Next::Error
|
|
1209
|
+
include ::HTTP2Next::FlowBuffer
|
|
1210
|
+
include ::HTTP2Next::Emitter
|
|
1211
|
+
|
|
1212
|
+
# Initializes new stream.
|
|
1213
|
+
#
|
|
1214
|
+
# Note that you should never have to call this directly. To create a new
|
|
1215
|
+
# client initiated stream, use Connection#new_stream. Similarly, Connection
|
|
1216
|
+
# will emit new stream objects, when new stream frames are received.
|
|
1217
|
+
#
|
|
1218
|
+
# @param id [Integer]
|
|
1219
|
+
# @param weight [Integer]
|
|
1220
|
+
# @param dependency [Integer]
|
|
1221
|
+
# @param exclusive [Boolean]
|
|
1222
|
+
# @param window [Integer]
|
|
1223
|
+
# @param parent [Stream]
|
|
1224
|
+
# @param state [Symbol]
|
|
1225
|
+
# @return [Stream] a new instance of Stream
|
|
1226
|
+
#
|
|
1227
|
+
# source://http-2-next//lib/http/2/next/stream.rb#76
|
|
1228
|
+
def initialize(connection:, id:, weight: T.unsafe(nil), dependency: T.unsafe(nil), exclusive: T.unsafe(nil), parent: T.unsafe(nil), state: T.unsafe(nil)); end
|
|
1229
|
+
|
|
1230
|
+
# Processes incoming HTTP 2.0 frames. The frames must be decoded upstream.
|
|
1231
|
+
#
|
|
1232
|
+
# @param frame [Hash]
|
|
1233
|
+
#
|
|
1234
|
+
# source://http-2-next//lib/http/2/next/stream.rb#106
|
|
1235
|
+
def <<(frame); end
|
|
1236
|
+
|
|
1237
|
+
# source://http-2-next//lib/http/2/next/stream.rb#179
|
|
1238
|
+
def calculate_content_length(data_length); end
|
|
1239
|
+
|
|
1240
|
+
# Sends a RST_STREAM indicating that the stream is no longer needed.
|
|
1241
|
+
#
|
|
1242
|
+
# source://http-2-next//lib/http/2/next/stream.rb#284
|
|
1243
|
+
def cancel; end
|
|
1244
|
+
|
|
1245
|
+
# Chunk data into max_size, yield each chunk, then return final chunk
|
|
1246
|
+
#
|
|
1247
|
+
# source://http-2-next//lib/http/2/next/stream.rb#265
|
|
1248
|
+
def chunk_data(payload, max_size); end
|
|
1249
|
+
|
|
1250
|
+
# Sends a RST_STREAM frame which closes current stream - this does not
|
|
1251
|
+
# close the underlying connection.
|
|
1252
|
+
#
|
|
1253
|
+
# @param error [:Symbol] optional reason why stream was closed
|
|
1254
|
+
#
|
|
1255
|
+
# source://http-2-next//lib/http/2/next/stream.rb#279
|
|
1256
|
+
def close(error = T.unsafe(nil)); end
|
|
1257
|
+
|
|
1258
|
+
# Reason why connection was closed.
|
|
1259
|
+
#
|
|
1260
|
+
# source://http-2-next//lib/http/2/next/stream.rb#61
|
|
1261
|
+
def closed; end
|
|
1262
|
+
|
|
1263
|
+
# @return [Boolean]
|
|
1264
|
+
#
|
|
1265
|
+
# source://http-2-next//lib/http/2/next/stream.rb#99
|
|
1266
|
+
def closed?; end
|
|
1267
|
+
|
|
1268
|
+
# Sends DATA frame containing response payload.
|
|
1269
|
+
#
|
|
1270
|
+
# @param payload [String]
|
|
1271
|
+
# @param end_stream [Boolean] indicates last response DATA frame
|
|
1272
|
+
#
|
|
1273
|
+
# source://http-2-next//lib/http/2/next/stream.rb#247
|
|
1274
|
+
def data(payload, end_stream: T.unsafe(nil)); end
|
|
1275
|
+
|
|
1276
|
+
# Returns the value of attribute dependency.
|
|
1277
|
+
#
|
|
1278
|
+
# source://http-2-next//lib/http/2/next/stream.rb#54
|
|
1279
|
+
def dependency; end
|
|
1280
|
+
|
|
1281
|
+
# Sends a HEADERS frame containing HTTP response headers.
|
|
1282
|
+
# All pseudo-header fields MUST appear in the header block before regular header fields.
|
|
1283
|
+
#
|
|
1284
|
+
# @param headers [Array or Hash] Array of key-value pairs or Hash
|
|
1285
|
+
# @param end_headers [Boolean] indicates that no more headers will be sent
|
|
1286
|
+
# @param end_stream [Boolean] indicates that no payload will be sent
|
|
1287
|
+
#
|
|
1288
|
+
# source://http-2-next//lib/http/2/next/stream.rb#218
|
|
1289
|
+
def headers(headers, end_headers: T.unsafe(nil), end_stream: T.unsafe(nil)); end
|
|
1290
|
+
|
|
1291
|
+
# Stream ID (odd for client initiated streams, even otherwise).
|
|
1292
|
+
#
|
|
1293
|
+
# source://http-2-next//lib/http/2/next/stream.rb#44
|
|
1294
|
+
def id; end
|
|
1295
|
+
|
|
1296
|
+
# Size of current stream flow control window.
|
|
1297
|
+
#
|
|
1298
|
+
# source://http-2-next//lib/http/2/next/stream.rb#57
|
|
1299
|
+
def local_window; end
|
|
1300
|
+
|
|
1301
|
+
# Request parent stream of push stream.
|
|
1302
|
+
#
|
|
1303
|
+
# source://http-2-next//lib/http/2/next/stream.rb#50
|
|
1304
|
+
def parent; end
|
|
1305
|
+
|
|
1306
|
+
# @raise [ArgumentError]
|
|
1307
|
+
#
|
|
1308
|
+
# source://http-2-next//lib/http/2/next/stream.rb#226
|
|
1309
|
+
def promise(headers, end_headers: T.unsafe(nil), &block); end
|
|
1310
|
+
|
|
1311
|
+
# Processes incoming HTTP 2.0 frames. The frames must be decoded upstream.
|
|
1312
|
+
#
|
|
1313
|
+
# @param frame [Hash]
|
|
1314
|
+
#
|
|
1315
|
+
# source://http-2-next//lib/http/2/next/stream.rb#106
|
|
1316
|
+
def receive(frame); end
|
|
1317
|
+
|
|
1318
|
+
# Sends a RST_STREAM indicating that the stream has been refused prior
|
|
1319
|
+
# to performing any application processing.
|
|
1320
|
+
#
|
|
1321
|
+
# source://http-2-next//lib/http/2/next/stream.rb#290
|
|
1322
|
+
def refuse; end
|
|
1323
|
+
|
|
1324
|
+
# Returns the value of attribute remote_window.
|
|
1325
|
+
#
|
|
1326
|
+
# source://http-2-next//lib/http/2/next/stream.rb#54
|
|
1327
|
+
def remote_window; end
|
|
1328
|
+
|
|
1329
|
+
# Sends a PRIORITY frame with new stream priority value (can only be
|
|
1330
|
+
# performed by the client).
|
|
1331
|
+
#
|
|
1332
|
+
# @param weight [Integer] new stream weight value
|
|
1333
|
+
# @param dependency [Integer] new stream dependency stream
|
|
1334
|
+
#
|
|
1335
|
+
# source://http-2-next//lib/http/2/next/stream.rb#238
|
|
1336
|
+
def reprioritize(weight: T.unsafe(nil), dependency: T.unsafe(nil), exclusive: T.unsafe(nil)); end
|
|
1337
|
+
|
|
1338
|
+
# Processes outgoing HTTP 2.0 frames. Data frames may be automatically
|
|
1339
|
+
# split and buffered based on maximum frame size and current stream flow
|
|
1340
|
+
# control window size.
|
|
1341
|
+
#
|
|
1342
|
+
# @param frame [Hash]
|
|
1343
|
+
#
|
|
1344
|
+
# source://http-2-next//lib/http/2/next/stream.rb#193
|
|
1345
|
+
def send(frame); end
|
|
1346
|
+
|
|
1347
|
+
# Stream state as defined by HTTP 2.0.
|
|
1348
|
+
#
|
|
1349
|
+
# source://http-2-next//lib/http/2/next/stream.rb#47
|
|
1350
|
+
def state; end
|
|
1351
|
+
|
|
1352
|
+
# source://http-2-next//lib/http/2/next/stream.rb#165
|
|
1353
|
+
def verify_trailers(frame); end
|
|
1354
|
+
|
|
1355
|
+
# Stream priority as set by initiator.
|
|
1356
|
+
#
|
|
1357
|
+
# source://http-2-next//lib/http/2/next/stream.rb#53
|
|
1358
|
+
def weight; end
|
|
1359
|
+
|
|
1360
|
+
# Size of current stream flow control window.
|
|
1361
|
+
#
|
|
1362
|
+
# source://http-2-next//lib/http/2/next/stream.rb#57
|
|
1363
|
+
def window; end
|
|
1364
|
+
|
|
1365
|
+
# Sends a WINDOW_UPDATE frame to the peer.
|
|
1366
|
+
#
|
|
1367
|
+
# @param increment [Integer]
|
|
1368
|
+
#
|
|
1369
|
+
# source://http-2-next//lib/http/2/next/stream.rb#297
|
|
1370
|
+
def window_update(increment); end
|
|
1371
|
+
|
|
1372
|
+
private
|
|
1373
|
+
|
|
1374
|
+
# source://http-2-next//lib/http/2/next/stream.rb#627
|
|
1375
|
+
def complete_transition(frame); end
|
|
1376
|
+
|
|
1377
|
+
# @return [Boolean]
|
|
1378
|
+
#
|
|
1379
|
+
# source://http-2-next//lib/http/2/next/stream.rb#654
|
|
1380
|
+
def end_stream?(frame); end
|
|
1381
|
+
|
|
1382
|
+
# @raise []
|
|
1383
|
+
#
|
|
1384
|
+
# source://http-2-next//lib/http/2/next/stream.rb#662
|
|
1385
|
+
def error(error = T.unsafe(nil), msg: T.unsafe(nil)); end
|
|
1386
|
+
|
|
1387
|
+
# source://http-2-next//lib/http/2/next/stream.rb#604
|
|
1388
|
+
def event(newstate); end
|
|
1389
|
+
|
|
1390
|
+
# source://http-2-next//lib/http/2/next/stream.rb#672
|
|
1391
|
+
def manage_state(frame); end
|
|
1392
|
+
|
|
1393
|
+
# source://http-2-next//lib/http/2/next/stream.rb#638
|
|
1394
|
+
def process_priority(frame); end
|
|
1395
|
+
|
|
1396
|
+
# @raise []
|
|
1397
|
+
#
|
|
1398
|
+
# source://http-2-next//lib/http/2/next/stream.rb#662
|
|
1399
|
+
def stream_error(error = T.unsafe(nil), msg: T.unsafe(nil)); end
|
|
1400
|
+
|
|
1401
|
+
# HTTP 2.0 Stream States
|
|
1402
|
+
# - http://tools.ietf.org/html/draft-ietf-httpbis-http2-16#section-5.1
|
|
1403
|
+
#
|
|
1404
|
+
# +--------+
|
|
1405
|
+
# send PP | | recv PP
|
|
1406
|
+
# ,--------| idle |--------.
|
|
1407
|
+
# / | | \
|
|
1408
|
+
# v +--------+ v
|
|
1409
|
+
# +----------+ | +----------+
|
|
1410
|
+
# | | | send H/ | |
|
|
1411
|
+
# ,-----| reserved | | recv H | reserved |-----.
|
|
1412
|
+
# | | (local) | | | (remote) | |
|
|
1413
|
+
# | +----------+ v +----------+ |
|
|
1414
|
+
# | | +--------+ | |
|
|
1415
|
+
# | | recv ES | | send ES | |
|
|
1416
|
+
# | send H | ,-------| open |-------. | recv H |
|
|
1417
|
+
# | | / | | \ | |
|
|
1418
|
+
# | v v +--------+ v v |
|
|
1419
|
+
# | +----------+ | +----------+ |
|
|
1420
|
+
# | | half | | | half | |
|
|
1421
|
+
# | | closed | | send R/ | closed | |
|
|
1422
|
+
# | | (remote) | | recv R | (local) | |
|
|
1423
|
+
# | +----------+ | +----------+ |
|
|
1424
|
+
# | | | | |
|
|
1425
|
+
# | | send ES/ | recv ES/ | |
|
|
1426
|
+
# | | send R/ v send R/ | |
|
|
1427
|
+
# | | recv R +--------+ recv R | |
|
|
1428
|
+
# | send R/ `----------->| |<-----------' send R/ |
|
|
1429
|
+
# | recv R | closed | recv R |
|
|
1430
|
+
# `---------------------->| |<----------------------'
|
|
1431
|
+
# +--------+
|
|
1432
|
+
#
|
|
1433
|
+
# source://http-2-next//lib/http/2/next/stream.rb#338
|
|
1434
|
+
def transition(frame, sending); end
|
|
1435
|
+
end
|
|
1436
|
+
|
|
1437
|
+
# source://http-2-next//lib/http/2/next/extensions.rb#14
|
|
1438
|
+
module HTTP2Next::StringExtensions; end
|
|
1439
|
+
|
|
1440
|
+
# source://http-2-next//lib/http/2/next/version.rb#4
|
|
1441
|
+
HTTP2Next::VERSION = T.let(T.unsafe(nil), String)
|