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.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +35 -0
- data/lib/e621stream/client/options.rb +20 -0
- data/lib/e621stream/client.rb +211 -0
- data/lib/e621stream/close_codes.rb +23 -0
- data/lib/e621stream/event.rb +24 -0
- data/lib/e621stream/events.rb +29 -0
- data/lib/e621stream/stream_error.rb +18 -0
- data/lib/e621stream/version.rb +5 -0
- data/lib/e621stream.rb +18 -0
- data/sorbet/config +6 -0
- data/sorbet/rbi/annotations/.gitattributes +1 -0
- data/sorbet/rbi/annotations/minitest.rbi +120 -0
- data/sorbet/rbi/annotations/rainbow.rbi +269 -0
- data/sorbet/rbi/gems/.gitattributes +1 -0
- data/sorbet/rbi/gems/ast@2.4.3.rbi +550 -0
- data/sorbet/rbi/gems/async-http@0.105.0.rbi +1649 -0
- data/sorbet/rbi/gems/async-pool@0.12.0.rbi +219 -0
- data/sorbet/rbi/gems/async-websocket@0.30.2.rbi +271 -0
- data/sorbet/rbi/gems/async@2.46.0.rbi +2193 -0
- data/sorbet/rbi/gems/benchmark@0.5.0.rbi +495 -0
- data/sorbet/rbi/gems/console@1.38.0.rbi +1552 -0
- data/sorbet/rbi/gems/erb@6.0.7.rbi +1581 -0
- data/sorbet/rbi/gems/erubi@1.13.1.rbi +153 -0
- data/sorbet/rbi/gems/fiber-annotation@0.2.0.rbi +62 -0
- data/sorbet/rbi/gems/fiber-local@1.1.0.rbi +36 -0
- data/sorbet/rbi/gems/fiber-storage@1.0.1.rbi +43 -0
- data/sorbet/rbi/gems/io-console@0.9.5.rbi +9 -0
- data/sorbet/rbi/gems/io-endpoint@0.19.0.rbi +1079 -0
- data/sorbet/rbi/gems/io-event@1.22.3.rbi +971 -0
- data/sorbet/rbi/gems/io-stream@0.14.0.rbi +805 -0
- data/sorbet/rbi/gems/json@3.1.0.rbi +1929 -0
- data/sorbet/rbi/gems/language_server-protocol@3.17.0.6.rbi +9 -0
- data/sorbet/rbi/gems/lint_roller@1.1.0.rbi +189 -0
- data/sorbet/rbi/gems/logger@1.7.0.rbi +896 -0
- data/sorbet/rbi/gems/minitest@5.27.0.rbi +1499 -0
- data/sorbet/rbi/gems/netrc@0.11.0.rbi +147 -0
- data/sorbet/rbi/gems/openssl@4.0.2.rbi +4366 -0
- data/sorbet/rbi/gems/parallel@2.3.0.rbi +332 -0
- data/sorbet/rbi/gems/parser@3.3.13.0.rbi +5146 -0
- data/sorbet/rbi/gems/pp@0.6.4.rbi +373 -0
- data/sorbet/rbi/gems/prettyprint@0.2.1.rbi +476 -0
- data/sorbet/rbi/gems/prism@1.9.0.rbi +42213 -0
- data/sorbet/rbi/gems/protocol-hpack@1.5.1.rbi +418 -0
- data/sorbet/rbi/gems/protocol-http1@0.41.1.rbi +894 -0
- data/sorbet/rbi/gems/protocol-http2@0.29.2.rbi +2277 -0
- data/sorbet/rbi/gems/protocol-http@0.72.1.rbi +3801 -0
- data/sorbet/rbi/gems/protocol-rack@0.23.0.rbi +9 -0
- data/sorbet/rbi/gems/protocol-url@0.19.0.rbi +9 -0
- data/sorbet/rbi/gems/protocol-websocket@0.21.3.rbi +1087 -0
- data/sorbet/rbi/gems/racc@1.8.1.rbi +169 -0
- data/sorbet/rbi/gems/rack@3.2.8.rbi +9 -0
- data/sorbet/rbi/gems/rainbow@3.1.1.rbi +362 -0
- data/sorbet/rbi/gems/rake@13.4.2.rbi +3127 -0
- data/sorbet/rbi/gems/rbi@0.5.0.rbi +5875 -0
- data/sorbet/rbi/gems/rbs@4.2.0.rbi +7133 -0
- data/sorbet/rbi/gems/rdoc@8.1.0.rbi +9 -0
- data/sorbet/rbi/gems/regexp_parser@2.13.1.rbi +3500 -0
- data/sorbet/rbi/gems/reline@0.7.0.rbi +2449 -0
- data/sorbet/rbi/gems/require-hooks@0.5.1.rbi +152 -0
- data/sorbet/rbi/gems/rexml@3.4.4.rbi +4905 -0
- data/sorbet/rbi/gems/rubocop-ast@1.51.0.rbi +7230 -0
- data/sorbet/rbi/gems/rubocop-rake@0.7.1.rbi +314 -0
- data/sorbet/rbi/gems/rubocop@1.92.2.rbi +69094 -0
- data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +988 -0
- data/sorbet/rbi/gems/rubydex@0.4.4.rbi +1620 -0
- data/sorbet/rbi/gems/spoom@1.8.13.rbi +7380 -0
- data/sorbet/rbi/gems/tapioca@0.20.0.rbi +3752 -0
- data/sorbet/rbi/gems/thor@1.5.0.rbi +3870 -0
- data/sorbet/rbi/gems/tsort@0.2.0.rbi +389 -0
- data/sorbet/rbi/gems/unicode-display_width@3.3.0.rbi +130 -0
- data/sorbet/rbi/gems/unicode-emoji@4.3.0.rbi +254 -0
- data/sorbet/rbi/gems/zeitwerk@2.8.3.rbi +1178 -0
- data/sorbet/tapioca/config.yml +13 -0
- data/sorbet/tapioca/require.rb +4 -0
- metadata +175 -0
|
@@ -0,0 +1,894 @@
|
|
|
1
|
+
# typed: true
|
|
2
|
+
|
|
3
|
+
# DO NOT EDIT MANUALLY
|
|
4
|
+
# This is an autogenerated file for types exported from the `protocol-http1` gem.
|
|
5
|
+
# Please instead update this file by running `bin/tapioca gem protocol-http1`.
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
# @namespace
|
|
9
|
+
# Released under the MIT License.
|
|
10
|
+
# Copyright, 2019-2026, by Samuel Williams.
|
|
11
|
+
#
|
|
12
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/version.rb:6
|
|
13
|
+
module Protocol; end
|
|
14
|
+
|
|
15
|
+
# @namespace
|
|
16
|
+
#
|
|
17
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/version.rb:7
|
|
18
|
+
module Protocol::HTTP1; end
|
|
19
|
+
|
|
20
|
+
# A header name or value was invalid, e.g. contains invalid characters.
|
|
21
|
+
#
|
|
22
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/error.rb:28
|
|
23
|
+
class Protocol::HTTP1::BadHeader < ::Protocol::HTTP1::BadRequest; end
|
|
24
|
+
|
|
25
|
+
# The request was not able to be parsed correctly, or failed some kind of validation.
|
|
26
|
+
#
|
|
27
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/error.rb:23
|
|
28
|
+
class Protocol::HTTP1::BadRequest < ::Protocol::HTTP1::Error
|
|
29
|
+
include ::Protocol::HTTP::BadRequest
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# A collection of classes for handling HTTP/1.1 request and response bodies.
|
|
33
|
+
#
|
|
34
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/body/chunked.rb:11
|
|
35
|
+
module Protocol::HTTP1::Body; end
|
|
36
|
+
|
|
37
|
+
# Represents a chunked body, which is a series of chunks, each with a length prefix.
|
|
38
|
+
#
|
|
39
|
+
# See https://tools.ietf.org/html/rfc7230#section-4.1 for more details on the chunked transfer encoding.
|
|
40
|
+
#
|
|
41
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/body/chunked.rb:15
|
|
42
|
+
class Protocol::HTTP1::Body::Chunked < ::Protocol::HTTP::Body::Readable
|
|
43
|
+
# Initialize the chunked body.
|
|
44
|
+
#
|
|
45
|
+
# @parameter connection [Protocol::HTTP1::Connection] the connection to read the body from.
|
|
46
|
+
# @parameter headers [Protocol::HTTP::Headers] the headers to read the trailer into, if any.
|
|
47
|
+
#
|
|
48
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/body/chunked.rb:25
|
|
49
|
+
def initialize(connection, headers); end
|
|
50
|
+
|
|
51
|
+
# @returns [Hash] JSON representation for tracing and debugging.
|
|
52
|
+
#
|
|
53
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/body/chunked.rb:140
|
|
54
|
+
def as_json(*, **, &); end
|
|
55
|
+
|
|
56
|
+
# Close the connection and mark the body as finished.
|
|
57
|
+
#
|
|
58
|
+
# @parameter error [Exception | Nil] the error that caused the body to be closed, if any.
|
|
59
|
+
#
|
|
60
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/body/chunked.rb:55
|
|
61
|
+
def close(error = T.unsafe(nil)); end
|
|
62
|
+
|
|
63
|
+
# @attribute [Integer] the number of chunks read so far.
|
|
64
|
+
#
|
|
65
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/body/chunked.rb:37
|
|
66
|
+
def count; end
|
|
67
|
+
|
|
68
|
+
# @returns [Boolean] true if the body is empty, in other words {read} will return `nil`.
|
|
69
|
+
#
|
|
70
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/body/chunked.rb:48
|
|
71
|
+
def empty?; end
|
|
72
|
+
|
|
73
|
+
# @returns [String] a human-readable representation of the body.
|
|
74
|
+
#
|
|
75
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/body/chunked.rb:135
|
|
76
|
+
def inspect; end
|
|
77
|
+
|
|
78
|
+
# @attribute [Integer] the length of the body if known.
|
|
79
|
+
#
|
|
80
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/body/chunked.rb:40
|
|
81
|
+
def length; end
|
|
82
|
+
|
|
83
|
+
# Read a chunk of data.
|
|
84
|
+
#
|
|
85
|
+
# Follows the procedure outlined in https://tools.ietf.org/html/rfc7230#section-4.1.3
|
|
86
|
+
#
|
|
87
|
+
# @returns [String | Nil] the next chunk of data, or `nil` if the body is finished.
|
|
88
|
+
# @raises [EOFError] if the connection is closed before the expected length is read.
|
|
89
|
+
#
|
|
90
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/body/chunked.rb:75
|
|
91
|
+
def read; end
|
|
92
|
+
|
|
93
|
+
private
|
|
94
|
+
|
|
95
|
+
# Read the trailer from the connection, and add any headers to the trailer.
|
|
96
|
+
#
|
|
97
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/body/chunked.rb:151
|
|
98
|
+
def read_trailer; end
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
# The maximum amount of body data returned by a single read.
|
|
102
|
+
#
|
|
103
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/body/chunked.rb:19
|
|
104
|
+
Protocol::HTTP1::Body::Chunked::BLOCK_SIZE = T.let(T.unsafe(nil), Integer)
|
|
105
|
+
|
|
106
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/body/chunked.rb:16
|
|
107
|
+
Protocol::HTTP1::Body::Chunked::CRLF = T.let(T.unsafe(nil), String)
|
|
108
|
+
|
|
109
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/body/chunked.rb:67
|
|
110
|
+
Protocol::HTTP1::Body::Chunked::VALID_CHUNK_LENGTH = T.let(T.unsafe(nil), Regexp)
|
|
111
|
+
|
|
112
|
+
# Represents a fixed length body.
|
|
113
|
+
#
|
|
114
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/body/fixed.rb:12
|
|
115
|
+
class Protocol::HTTP1::Body::Fixed < ::Protocol::HTTP::Body::Readable
|
|
116
|
+
# Initialize the body with the given connection and length.
|
|
117
|
+
#
|
|
118
|
+
# @parameter connection [Protocol::HTTP1::Connection] the connection to read the body from.
|
|
119
|
+
# @parameter length [Integer] the length of the body.
|
|
120
|
+
#
|
|
121
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/body/fixed.rb:20
|
|
122
|
+
def initialize(connection, length); end
|
|
123
|
+
|
|
124
|
+
# @returns [Hash] JSON representation for tracing and debugging.
|
|
125
|
+
#
|
|
126
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/body/fixed.rb:84
|
|
127
|
+
def as_json(*, **, &); end
|
|
128
|
+
|
|
129
|
+
# Close the connection.
|
|
130
|
+
#
|
|
131
|
+
# @parameter error [Exception | Nil] the error that caused the connection to be closed, if any.
|
|
132
|
+
#
|
|
133
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/body/fixed.rb:41
|
|
134
|
+
def close(error = T.unsafe(nil)); end
|
|
135
|
+
|
|
136
|
+
# @returns [Boolean] true if the body is empty.
|
|
137
|
+
#
|
|
138
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/body/fixed.rb:34
|
|
139
|
+
def empty?; end
|
|
140
|
+
|
|
141
|
+
# @returns [String] a human-readable representation of the body.
|
|
142
|
+
#
|
|
143
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/body/fixed.rb:79
|
|
144
|
+
def inspect; end
|
|
145
|
+
|
|
146
|
+
# @attribute [Integer] the length of the body.
|
|
147
|
+
#
|
|
148
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/body/fixed.rb:28
|
|
149
|
+
def length; end
|
|
150
|
+
|
|
151
|
+
# Read a chunk of data.
|
|
152
|
+
#
|
|
153
|
+
# @returns [String | Nil] the next chunk of data.
|
|
154
|
+
# @raises [EOFError] if the connection is closed before the expected length is read.
|
|
155
|
+
#
|
|
156
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/body/fixed.rb:57
|
|
157
|
+
def read; end
|
|
158
|
+
|
|
159
|
+
# @attribute [Integer] the remaining bytes to read.
|
|
160
|
+
#
|
|
161
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/body/fixed.rb:31
|
|
162
|
+
def remaining; end
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
# The maximum amount of body data returned by a single read.
|
|
166
|
+
#
|
|
167
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/body/fixed.rb:14
|
|
168
|
+
Protocol::HTTP1::Body::Fixed::BLOCK_SIZE = T.let(T.unsafe(nil), Integer)
|
|
169
|
+
|
|
170
|
+
# Represents the remainder of the body, which reads all the data from the connection until it is finished.
|
|
171
|
+
#
|
|
172
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/body/remainder.rb:12
|
|
173
|
+
class Protocol::HTTP1::Body::Remainder < ::Protocol::HTTP::Body::Readable
|
|
174
|
+
# Initialize the body with the given connection.
|
|
175
|
+
#
|
|
176
|
+
# @parameter connection [Protocol::HTTP1::Connection] the connection to read the body from.
|
|
177
|
+
#
|
|
178
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/body/remainder.rb:18
|
|
179
|
+
def initialize(connection, block_size: T.unsafe(nil)); end
|
|
180
|
+
|
|
181
|
+
# @returns [Hash] JSON representation for tracing and debugging.
|
|
182
|
+
#
|
|
183
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/body/remainder.rb:67
|
|
184
|
+
def as_json(*, **, &); end
|
|
185
|
+
|
|
186
|
+
# Close the connection.
|
|
187
|
+
#
|
|
188
|
+
# @parameter error [Exception | Nil] the error that caused the connection to be closed, if any.
|
|
189
|
+
#
|
|
190
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/body/remainder.rb:41
|
|
191
|
+
def close(error = T.unsafe(nil)); end
|
|
192
|
+
|
|
193
|
+
# Discard the body, which will close the connection and prevent further reads.
|
|
194
|
+
#
|
|
195
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/body/remainder.rb:29
|
|
196
|
+
def discard; end
|
|
197
|
+
|
|
198
|
+
# @returns [Boolean] true if the body is empty.
|
|
199
|
+
#
|
|
200
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/body/remainder.rb:24
|
|
201
|
+
def empty?; end
|
|
202
|
+
|
|
203
|
+
# @returns [String] a human-readable representation of the body.
|
|
204
|
+
#
|
|
205
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/body/remainder.rb:62
|
|
206
|
+
def inspect; end
|
|
207
|
+
|
|
208
|
+
# Read a chunk of data.
|
|
209
|
+
#
|
|
210
|
+
# @returns [String | Nil] the next chunk of data.
|
|
211
|
+
#
|
|
212
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/body/remainder.rb:50
|
|
213
|
+
def read; end
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/body/remainder.rb:13
|
|
217
|
+
Protocol::HTTP1::Body::Remainder::BLOCK_SIZE = T.let(T.unsafe(nil), Integer)
|
|
218
|
+
|
|
219
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:25
|
|
220
|
+
Protocol::HTTP1::CHUNKED = T.let(T.unsafe(nil), String)
|
|
221
|
+
|
|
222
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:28
|
|
223
|
+
Protocol::HTTP1::CLOSE = T.let(T.unsafe(nil), String)
|
|
224
|
+
|
|
225
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:27
|
|
226
|
+
Protocol::HTTP1::CONNECTION = T.let(T.unsafe(nil), String)
|
|
227
|
+
|
|
228
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:22
|
|
229
|
+
Protocol::HTTP1::CONTENT_LENGTH = T.let(T.unsafe(nil), String)
|
|
230
|
+
|
|
231
|
+
# Represents a single HTTP/1.x connection, which may be used to send and receive multiple requests and responses.
|
|
232
|
+
#
|
|
233
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:52
|
|
234
|
+
class Protocol::HTTP1::Connection
|
|
235
|
+
# Initialize the connection with the given stream.
|
|
236
|
+
#
|
|
237
|
+
# @parameter stream [IO] the stream to read and write data from.
|
|
238
|
+
# @parameter persistent [Boolean] whether the connection is persistent.
|
|
239
|
+
# @parameter state [Symbol] the initial state of the connection, typically idle.
|
|
240
|
+
#
|
|
241
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:66
|
|
242
|
+
def initialize(stream, persistent: T.unsafe(nil), state: T.unsafe(nil), maximum_line_length: T.unsafe(nil)); end
|
|
243
|
+
|
|
244
|
+
# Close the connection and underlying stream and transition to the closed state.
|
|
245
|
+
#
|
|
246
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:227
|
|
247
|
+
def close(error = T.unsafe(nil)); end
|
|
248
|
+
|
|
249
|
+
# Transition to the closed state.
|
|
250
|
+
#
|
|
251
|
+
# If no error occurred, and the connection is persistent, this will immediately transition to the idle state.
|
|
252
|
+
#
|
|
253
|
+
# @parameter error [Exxception] the error that caused the connection to close.
|
|
254
|
+
#
|
|
255
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:775
|
|
256
|
+
def close!(error = T.unsafe(nil)); end
|
|
257
|
+
|
|
258
|
+
# Close the read end of the connection and transition to the half-closed remote state (or closed if already in the half-closed local state).
|
|
259
|
+
#
|
|
260
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:218
|
|
261
|
+
def close_read; end
|
|
262
|
+
|
|
263
|
+
# The connection (stream) was closed. It may now be in the idle state.
|
|
264
|
+
#
|
|
265
|
+
# Sub-classes may override this method to perform additional cleanup.
|
|
266
|
+
#
|
|
267
|
+
# @parameter error [Exception | Nil] the error that caused the connection to be closed, if any.
|
|
268
|
+
#
|
|
269
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:767
|
|
270
|
+
def closed(error = T.unsafe(nil)); end
|
|
271
|
+
|
|
272
|
+
# @return [Boolean] whether the connection is in the closed state.
|
|
273
|
+
#
|
|
274
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:145
|
|
275
|
+
def closed?; end
|
|
276
|
+
|
|
277
|
+
# @attribute [Integer] the number of requests and responses processed by this connection.
|
|
278
|
+
#
|
|
279
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:150
|
|
280
|
+
def count; end
|
|
281
|
+
|
|
282
|
+
# Extract the content length from the headers, if possible.
|
|
283
|
+
#
|
|
284
|
+
# @parameter headers [Hash] the headers.
|
|
285
|
+
# @yields {|length| ...} if a content length is found.
|
|
286
|
+
# @parameter length [Integer] the content length.
|
|
287
|
+
# @raises [BadRequest] if the content length is invalid.
|
|
288
|
+
#
|
|
289
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:910
|
|
290
|
+
def extract_content_length(headers); end
|
|
291
|
+
|
|
292
|
+
# @return [Boolean] whether the connection is in the half-closed local state.
|
|
293
|
+
#
|
|
294
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:135
|
|
295
|
+
def half_closed_local?; end
|
|
296
|
+
|
|
297
|
+
# @return [Boolean] whether the connection is in the half-closed remote state.
|
|
298
|
+
#
|
|
299
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:140
|
|
300
|
+
def half_closed_remote?; end
|
|
301
|
+
|
|
302
|
+
# Hijack the connection - that is, take over the underlying IO and close the connection.
|
|
303
|
+
#
|
|
304
|
+
# @returns [IO | Nil] the underlying non-blocking IO.
|
|
305
|
+
#
|
|
306
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:203
|
|
307
|
+
def hijack!; end
|
|
308
|
+
|
|
309
|
+
# Indicates whether the connection has been hijacked meaning its IO has been handed over and is not usable anymore.
|
|
310
|
+
#
|
|
311
|
+
# @returns [Boolean] hijack status
|
|
312
|
+
#
|
|
313
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:196
|
|
314
|
+
def hijacked?; end
|
|
315
|
+
|
|
316
|
+
# @return [Boolean] whether the connection is in the idle state.
|
|
317
|
+
#
|
|
318
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:125
|
|
319
|
+
def idle?; end
|
|
320
|
+
|
|
321
|
+
# Indicates whether the status code is an interim status code.
|
|
322
|
+
#
|
|
323
|
+
# @parameter status [Integer] the status code.
|
|
324
|
+
# @returns [Boolean] whether the status code is an interim status code.
|
|
325
|
+
#
|
|
326
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:485
|
|
327
|
+
def interim_status?(status); end
|
|
328
|
+
|
|
329
|
+
# Force a transition to the open state.
|
|
330
|
+
#
|
|
331
|
+
# @raises [ProtocolError] if the connection is not in the idle state.
|
|
332
|
+
#
|
|
333
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:244
|
|
334
|
+
def open!; end
|
|
335
|
+
|
|
336
|
+
# @return [Boolean] whether the connection is in the open state.
|
|
337
|
+
#
|
|
338
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:130
|
|
339
|
+
def open?; end
|
|
340
|
+
|
|
341
|
+
# @attribute [Boolean] true if the connection is persistent.
|
|
342
|
+
#
|
|
343
|
+
# This determines what connection headers are sent in the response and whether the connection can be reused after the response is sent. This setting is automatically managed according to the nature of the request and response. Changing to false is safe. Changing to true from outside this class should generally be avoided and, depending on the response semantics, may be reset to false anyway.
|
|
344
|
+
#
|
|
345
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:83
|
|
346
|
+
def persistent; end
|
|
347
|
+
|
|
348
|
+
# @attribute [Boolean] true if the connection is persistent.
|
|
349
|
+
#
|
|
350
|
+
# This determines what connection headers are sent in the response and whether the connection can be reused after the response is sent. This setting is automatically managed according to the nature of the request and response. Changing to false is safe. Changing to true from outside this class should generally be avoided and, depending on the response semantics, may be reset to false anyway.
|
|
351
|
+
#
|
|
352
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:83
|
|
353
|
+
def persistent=(_arg0); end
|
|
354
|
+
|
|
355
|
+
# Indicates whether the connection is persistent given the version, method, and headers.
|
|
356
|
+
#
|
|
357
|
+
# @parameter version [String] the HTTP version.
|
|
358
|
+
# @parameter method [String] the HTTP method.
|
|
359
|
+
# @parameter headers [Hash] the HTTP headers.
|
|
360
|
+
# @return [Boolean] whether the connection can be persistent.
|
|
361
|
+
#
|
|
362
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:158
|
|
363
|
+
def persistent?(version, method, headers); end
|
|
364
|
+
|
|
365
|
+
# Read some data from the connection.
|
|
366
|
+
#
|
|
367
|
+
# @parameter length [Integer] the number of bytes to read.
|
|
368
|
+
#
|
|
369
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:380
|
|
370
|
+
def read(length); end
|
|
371
|
+
|
|
372
|
+
# Read the body of the message.
|
|
373
|
+
#
|
|
374
|
+
# - The `transfer-encoding` header is used to determine if the body is chunked.
|
|
375
|
+
# - Otherwise, if the `content-length` is present, the body is read until the content length is reached.
|
|
376
|
+
# - Otherwise, if `remainder` is true, the body is read until the connection is closed.
|
|
377
|
+
#
|
|
378
|
+
# @parameter headers [Hash] the headers of the message.
|
|
379
|
+
# @parameter remainder [Boolean] whether to read the remainder of the body.
|
|
380
|
+
# @returns [Object] the body.
|
|
381
|
+
#
|
|
382
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:1008
|
|
383
|
+
def read_body(headers, remainder = T.unsafe(nil)); end
|
|
384
|
+
|
|
385
|
+
# Read the body, assuming it is using the chunked transfer encoding.
|
|
386
|
+
#
|
|
387
|
+
# @parameters headers [Hash] the headers of the request.
|
|
388
|
+
# @returns [Protocol::HTTP1::Body::Chunked] the body.
|
|
389
|
+
#
|
|
390
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:844
|
|
391
|
+
def read_chunked_body(headers); end
|
|
392
|
+
|
|
393
|
+
# Read the body, assuming it has a fixed length.
|
|
394
|
+
#
|
|
395
|
+
# @parameters length [Integer] the length of the body.
|
|
396
|
+
# @returns [Protocol::HTTP1::Body::Fixed] the body.
|
|
397
|
+
#
|
|
398
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:852
|
|
399
|
+
def read_fixed_body(length); end
|
|
400
|
+
|
|
401
|
+
# Read the body, assuming that we are not receiving any actual data, but just the length.
|
|
402
|
+
#
|
|
403
|
+
# @parameters length [Integer] the length of the body.
|
|
404
|
+
# @returns [Protocol::HTTP::Body::Head] the body.
|
|
405
|
+
#
|
|
406
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:868
|
|
407
|
+
def read_head_body(length); end
|
|
408
|
+
|
|
409
|
+
# Read headers from the connection until an empty line is encountered.
|
|
410
|
+
#
|
|
411
|
+
# @returns [HTTP::Headers] the headers read.
|
|
412
|
+
# @raises [EOFError] if the connection is closed.
|
|
413
|
+
# @raises [BadHeader] if a header could not be parsed.
|
|
414
|
+
#
|
|
415
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:531
|
|
416
|
+
def read_headers; end
|
|
417
|
+
|
|
418
|
+
# Read a line from the connection.
|
|
419
|
+
#
|
|
420
|
+
# @raises [EOFError] if a line could not be read.
|
|
421
|
+
# @raises [LineLengthError] if the line is too long.
|
|
422
|
+
#
|
|
423
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:414
|
|
424
|
+
def read_line; end
|
|
425
|
+
|
|
426
|
+
# Read a line from the connection.
|
|
427
|
+
#
|
|
428
|
+
# @returns [String | Nil] the line read, or nil if the connection is closed.
|
|
429
|
+
# @raises [LineLengthError] if the line is too long.
|
|
430
|
+
# @raises [ProtocolError] if the line is not terminated properly.
|
|
431
|
+
#
|
|
432
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:391
|
|
433
|
+
def read_line?; end
|
|
434
|
+
|
|
435
|
+
# Read the body, assuming that we read until the connection is closed.
|
|
436
|
+
#
|
|
437
|
+
# @returns [Protocol::HTTP1::Body::Remainder] the body.
|
|
438
|
+
#
|
|
439
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:859
|
|
440
|
+
def read_remainder_body; end
|
|
441
|
+
|
|
442
|
+
# Read a request from the connection, including the request line and request headers, and prepares to read the request body.
|
|
443
|
+
#
|
|
444
|
+
# Transitions to the open state.
|
|
445
|
+
#
|
|
446
|
+
# @yields {|host, method, path, version, headers, body| ...} if a block is given.
|
|
447
|
+
# @returns [Tuple(String, String, String, String, HTTP::Headers, Protocol::HTTP1::Body) | Nil] the host, method, path, version, headers, and body of the request, or `nil` if the connection is closed.
|
|
448
|
+
# @raises [ProtocolError] if the connection is not in the idle state.
|
|
449
|
+
#
|
|
450
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:440
|
|
451
|
+
def read_request; end
|
|
452
|
+
|
|
453
|
+
# Read the body of the request.
|
|
454
|
+
#
|
|
455
|
+
# - The `CONNECT` method is used to establish a tunnel, so the body is read until the connection is closed.
|
|
456
|
+
# - The `UPGRADE` method is used to upgrade the connection to a different protocol (typically WebSockets), so the body is read until the connection is closed.
|
|
457
|
+
# - Otherwise, the body is read according to {read_body}.
|
|
458
|
+
#
|
|
459
|
+
# @parameter method [String] the HTTP method.
|
|
460
|
+
# @parameter headers [Hash] the headers of the request.
|
|
461
|
+
#
|
|
462
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:979
|
|
463
|
+
def read_request_body(method, headers); end
|
|
464
|
+
|
|
465
|
+
# Read a request line from the connection.
|
|
466
|
+
#
|
|
467
|
+
# @returns [Tuple(String, String, String) | Nil] the method, path, and version of the request, or nil if the connection is closed.
|
|
468
|
+
#
|
|
469
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:421
|
|
470
|
+
def read_request_line; end
|
|
471
|
+
|
|
472
|
+
# Read a response from the connection.
|
|
473
|
+
#
|
|
474
|
+
# @parameter method [String] the HTTP method.
|
|
475
|
+
# @yields {|version, status, reason, headers, body| ...} if a block is given.
|
|
476
|
+
# @returns [Tuple(String, Integer, String, HTTP::Headers, Protocol::HTTP1::Body)] the version, status, reason, headers, and body of the response.
|
|
477
|
+
# @raises [ProtocolError] if the connection is not in the open or half-closed local state.
|
|
478
|
+
# @raises [EOFError] if the connection is closed.
|
|
479
|
+
#
|
|
480
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:496
|
|
481
|
+
def read_response(method); end
|
|
482
|
+
|
|
483
|
+
# Read the body of the response.
|
|
484
|
+
#
|
|
485
|
+
# - The `HEAD` method is used to retrieve the headers of the response without the body, so {read_head_body} is invoked if there is a content length, otherwise nil is returned.
|
|
486
|
+
# - A 101 status code indicates that the connection will be upgraded, so {read_upgrade_body} is invoked.
|
|
487
|
+
# - Interim status codes (1xx), no content (204) and not modified (304) status codes do not have a body, so nil is returned.
|
|
488
|
+
# - The `CONNECT` method is used to establish a tunnel, so {read_tunnel_body} is invoked.
|
|
489
|
+
# - Otherwise, the body is read according to {read_body}.
|
|
490
|
+
#
|
|
491
|
+
# @parameter method [String] the HTTP method.
|
|
492
|
+
# @parameter status [Integer] the HTTP status code.
|
|
493
|
+
# @parameter headers [Hash] the headers of the response.
|
|
494
|
+
#
|
|
495
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:931
|
|
496
|
+
def read_response_body(method, status, headers); end
|
|
497
|
+
|
|
498
|
+
# Read a response line from the connection.
|
|
499
|
+
#
|
|
500
|
+
# @returns [Tuple(String, Integer, String)] the version, status, and reason of the response.
|
|
501
|
+
# @raises [EOFError] if the connection is closed.
|
|
502
|
+
#
|
|
503
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:473
|
|
504
|
+
def read_response_line; end
|
|
505
|
+
|
|
506
|
+
# Read the body, assuming it is a tunnel.
|
|
507
|
+
#
|
|
508
|
+
# Invokes {read_remainder_body}.
|
|
509
|
+
#
|
|
510
|
+
# @returns [Protocol::HTTP::Body::Remainder] the body.
|
|
511
|
+
#
|
|
512
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:880
|
|
513
|
+
def read_tunnel_body; end
|
|
514
|
+
|
|
515
|
+
# Read the body, assuming it is an upgrade.
|
|
516
|
+
#
|
|
517
|
+
# Invokes {read_remainder_body}.
|
|
518
|
+
#
|
|
519
|
+
# @returns [Protocol::HTTP::Body::Remainder] the body.
|
|
520
|
+
#
|
|
521
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:889
|
|
522
|
+
def read_upgrade_body; end
|
|
523
|
+
|
|
524
|
+
# Read some data from the connection.
|
|
525
|
+
#
|
|
526
|
+
# @parameter length [Integer] the maximum number of bytes to read.
|
|
527
|
+
#
|
|
528
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:371
|
|
529
|
+
def readpartial(length); end
|
|
530
|
+
|
|
531
|
+
# Indicate that the end of the stream (body) has been received.
|
|
532
|
+
#
|
|
533
|
+
# This will transition to the half-closed remote state if the connection is open, or the closed state if the connection is half-closed local.
|
|
534
|
+
#
|
|
535
|
+
# @raises [ProtocolError] if the connection is not in the open or half-closed remote state.
|
|
536
|
+
#
|
|
537
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:830
|
|
538
|
+
def receive_end_stream!; end
|
|
539
|
+
|
|
540
|
+
# Transition to the half-closed local state, in other words, the connection is closed for writing.
|
|
541
|
+
#
|
|
542
|
+
# If the connection is already in the half-closed remote state, it will transition to the closed state.
|
|
543
|
+
#
|
|
544
|
+
# @raises [ProtocolError] if the connection is not in the open state.
|
|
545
|
+
#
|
|
546
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:553
|
|
547
|
+
def send_end_stream!; end
|
|
548
|
+
|
|
549
|
+
# The current state of the connection.
|
|
550
|
+
#
|
|
551
|
+
# ```
|
|
552
|
+
# ┌────────┐
|
|
553
|
+
# │ │
|
|
554
|
+
# ┌───────────────────────►│ idle │
|
|
555
|
+
# │ │ │
|
|
556
|
+
# │ └───┬────┘
|
|
557
|
+
# │ │
|
|
558
|
+
# │ │ send request /
|
|
559
|
+
# │ │ receive request
|
|
560
|
+
# │ │
|
|
561
|
+
# │ ▼
|
|
562
|
+
# │ ┌────────┐
|
|
563
|
+
# │ recv ES │ │ send ES
|
|
564
|
+
# │ ┌────────────┤ open ├────────────┐
|
|
565
|
+
# │ │ │ │ │
|
|
566
|
+
# │ ▼ └───┬────┘ ▼
|
|
567
|
+
# │ ┌──────────┐ │ ┌──────────┐
|
|
568
|
+
# │ │ half │ │ │ half │
|
|
569
|
+
# │ │ closed │ │ send R / │ closed │
|
|
570
|
+
# │ │ (remote) │ │ recv R │ (local) │
|
|
571
|
+
# │ └────┬─────┘ │ └─────┬────┘
|
|
572
|
+
# │ │ │ │
|
|
573
|
+
# │ │ send ES / │ recv ES / │
|
|
574
|
+
# │ │ close ▼ close │
|
|
575
|
+
# │ │ ┌────────┐ │
|
|
576
|
+
# │ └───────────►│ │◄───────────┘
|
|
577
|
+
# │ │ closed │
|
|
578
|
+
# └────────────────────────┤ │
|
|
579
|
+
# persistent └────────┘
|
|
580
|
+
# ```
|
|
581
|
+
#
|
|
582
|
+
# - `ES`: the body was fully received or sent (end of stream).
|
|
583
|
+
# - `R`: the connection was closed unexpectedly (reset).
|
|
584
|
+
#
|
|
585
|
+
# State transition methods use a trailing "!".
|
|
586
|
+
#
|
|
587
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:122
|
|
588
|
+
def state; end
|
|
589
|
+
|
|
590
|
+
# The current state of the connection.
|
|
591
|
+
#
|
|
592
|
+
# ```
|
|
593
|
+
# ┌────────┐
|
|
594
|
+
# │ │
|
|
595
|
+
# ┌───────────────────────►│ idle │
|
|
596
|
+
# │ │ │
|
|
597
|
+
# │ └───┬────┘
|
|
598
|
+
# │ │
|
|
599
|
+
# │ │ send request /
|
|
600
|
+
# │ │ receive request
|
|
601
|
+
# │ │
|
|
602
|
+
# │ ▼
|
|
603
|
+
# │ ┌────────┐
|
|
604
|
+
# │ recv ES │ │ send ES
|
|
605
|
+
# │ ┌────────────┤ open ├────────────┐
|
|
606
|
+
# │ │ │ │ │
|
|
607
|
+
# │ ▼ └───┬────┘ ▼
|
|
608
|
+
# │ ┌──────────┐ │ ┌──────────┐
|
|
609
|
+
# │ │ half │ │ │ half │
|
|
610
|
+
# │ │ closed │ │ send R / │ closed │
|
|
611
|
+
# │ │ (remote) │ │ recv R │ (local) │
|
|
612
|
+
# │ └────┬─────┘ │ └─────┬────┘
|
|
613
|
+
# │ │ │ │
|
|
614
|
+
# │ │ send ES / │ recv ES / │
|
|
615
|
+
# │ │ close ▼ close │
|
|
616
|
+
# │ │ ┌────────┐ │
|
|
617
|
+
# │ └───────────►│ │◄───────────┘
|
|
618
|
+
# │ │ closed │
|
|
619
|
+
# └────────────────────────┤ │
|
|
620
|
+
# persistent └────────┘
|
|
621
|
+
# ```
|
|
622
|
+
#
|
|
623
|
+
# - `ES`: the body was fully received or sent (end of stream).
|
|
624
|
+
# - `R`: the connection was closed unexpectedly (reset).
|
|
625
|
+
#
|
|
626
|
+
# State transition methods use a trailing "!".
|
|
627
|
+
#
|
|
628
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:122
|
|
629
|
+
def state=(_arg0); end
|
|
630
|
+
|
|
631
|
+
# The underlying IO stream.
|
|
632
|
+
#
|
|
633
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:78
|
|
634
|
+
def stream; end
|
|
635
|
+
|
|
636
|
+
# Write a body to the connection.
|
|
637
|
+
#
|
|
638
|
+
# The behavior of this method is determined by the HTTP version, the body, and the request method. We try to choose the best approach possible, given the constraints, connection persistence, whether the length is known, etc.
|
|
639
|
+
#
|
|
640
|
+
# @parameter version [String] the HTTP version.
|
|
641
|
+
# @parameter body [Object] the body to write.
|
|
642
|
+
# @parameter head [Boolean] whether the request was a `HEAD` request.
|
|
643
|
+
# @parameter trailer [Hash | Nil] the trailers to write.
|
|
644
|
+
#
|
|
645
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:794
|
|
646
|
+
def write_body(version, body, head = T.unsafe(nil), trailer = T.unsafe(nil)); end
|
|
647
|
+
|
|
648
|
+
# Write the body to the connection and close the connection.
|
|
649
|
+
#
|
|
650
|
+
# @parameter body [Object] the body to write.
|
|
651
|
+
# @parameter head [Boolean] whether the request was a `HEAD` request.
|
|
652
|
+
#
|
|
653
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:735
|
|
654
|
+
def write_body_and_close(body, head); end
|
|
655
|
+
|
|
656
|
+
# Write a chunked body to the connection.
|
|
657
|
+
#
|
|
658
|
+
# If the request was a `HEAD` request, the body will be closed, and no data will be written.
|
|
659
|
+
#
|
|
660
|
+
# If trailers are given, they will be written after the body.
|
|
661
|
+
#
|
|
662
|
+
# @parameter body [Object] the body to write.
|
|
663
|
+
# @parameter head [Boolean] whether the request was a `HEAD` request.
|
|
664
|
+
# @parameter trailer [Hash | Nil] the trailers to write.
|
|
665
|
+
#
|
|
666
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:693
|
|
667
|
+
def write_chunked_body(body, head, trailer = T.unsafe(nil)); end
|
|
668
|
+
|
|
669
|
+
# Write the appropriate header for connection persistence.
|
|
670
|
+
#
|
|
671
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:179
|
|
672
|
+
def write_connection_header(version); end
|
|
673
|
+
|
|
674
|
+
# Write an empty body to the connection.
|
|
675
|
+
#
|
|
676
|
+
# If given, the body will be closed.
|
|
677
|
+
#
|
|
678
|
+
# @parameter body [Object | Nil] the body to write.
|
|
679
|
+
#
|
|
680
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:631
|
|
681
|
+
def write_empty_body(body = T.unsafe(nil)); end
|
|
682
|
+
|
|
683
|
+
# Write a fixed length body to the connection.
|
|
684
|
+
#
|
|
685
|
+
# If the request was a `HEAD` request, the body will be closed, and no data will be written.
|
|
686
|
+
#
|
|
687
|
+
# @parameter body [Object] the body to write.
|
|
688
|
+
# @parameter length [Integer] the length of the body.
|
|
689
|
+
# @parameter head [Boolean] whether the request was a `HEAD` request.
|
|
690
|
+
# @raises [ContentLengthError] if the body length does not match the content length specified.
|
|
691
|
+
#
|
|
692
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:648
|
|
693
|
+
def write_fixed_length_body(body, length, head); end
|
|
694
|
+
|
|
695
|
+
# Write a header to the connection, rejecting CR, LF, and NUL in its value.
|
|
696
|
+
#
|
|
697
|
+
# @parameter name [String] the header name.
|
|
698
|
+
# @parameter value [String] the header value.
|
|
699
|
+
# @raises [BadHeader] if the header name or value is invalid.
|
|
700
|
+
#
|
|
701
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:340
|
|
702
|
+
def write_header(name, value); end
|
|
703
|
+
|
|
704
|
+
# Write headers to the connection.
|
|
705
|
+
#
|
|
706
|
+
# @parameter headers [Hash] the headers to write.
|
|
707
|
+
# @raises [BadHeader] if the header name or value is invalid.
|
|
708
|
+
#
|
|
709
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:362
|
|
710
|
+
def write_headers(headers); end
|
|
711
|
+
|
|
712
|
+
# Write an interim response to the connection. It is expected you will eventually write the final response after this method.
|
|
713
|
+
#
|
|
714
|
+
# @parameter version [String] the HTTP version.
|
|
715
|
+
# @parameter status [Integer] the HTTP status code.
|
|
716
|
+
# @parameter headers [Hash] the HTTP headers.
|
|
717
|
+
# @parameter reason [String] the reason phrase, defaults to the standard reason phrase for the status code.
|
|
718
|
+
# @raises [ProtocolError] if the connection is not in the open or half-closed remote state.
|
|
719
|
+
#
|
|
720
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:320
|
|
721
|
+
def write_interim_response(version, status, headers, reason = T.unsafe(nil)); end
|
|
722
|
+
|
|
723
|
+
# Write a request to the connection. It is expected you will write the body after this method.
|
|
724
|
+
#
|
|
725
|
+
# Transitions to the open state.
|
|
726
|
+
#
|
|
727
|
+
# Requires the method to be an HTTP token and rejects CR, LF, and NUL bytes in the authority and target before writing any request bytes.
|
|
728
|
+
#
|
|
729
|
+
# @parameter authority [String] the authority of the request.
|
|
730
|
+
# @parameter method [String] the HTTP method.
|
|
731
|
+
# @parameter target [String] the request target.
|
|
732
|
+
# @parameter version [String] the HTTP version.
|
|
733
|
+
# @parameter headers [Hash] the HTTP headers.
|
|
734
|
+
# @raises [RefusedError] if the request was not processed.
|
|
735
|
+
#
|
|
736
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:266
|
|
737
|
+
def write_request(authority, method, target, version, headers); end
|
|
738
|
+
|
|
739
|
+
# Write a response to the connection. It is expected you will write the body after this method.
|
|
740
|
+
#
|
|
741
|
+
# @parameter version [String] the HTTP version.
|
|
742
|
+
# @parameter status [Integer] the HTTP status code.
|
|
743
|
+
# @parameter headers [Hash] the HTTP headers.
|
|
744
|
+
# @parameter reason [String] the reason phrase, defaults to the standard reason phrase for the status code.
|
|
745
|
+
#
|
|
746
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:300
|
|
747
|
+
def write_response(version, status, headers, reason = T.unsafe(nil)); end
|
|
748
|
+
|
|
749
|
+
# Write a tunnel body to the connection.
|
|
750
|
+
#
|
|
751
|
+
# This writes the connection header and the body to the connection. If the body is `nil`, you should coordinate writing to the stream.
|
|
752
|
+
#
|
|
753
|
+
# The connection will not be persistent after this method is called.
|
|
754
|
+
#
|
|
755
|
+
# @parameter version [String] the HTTP version.
|
|
756
|
+
# @parameter body [Object | Nil] the body to write.
|
|
757
|
+
# @returns [IO] the underlying IO stream.
|
|
758
|
+
#
|
|
759
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:604
|
|
760
|
+
def write_tunnel_body(version, body = T.unsafe(nil)); end
|
|
761
|
+
|
|
762
|
+
# Write an upgrade body to the connection.
|
|
763
|
+
#
|
|
764
|
+
# This writes the upgrade header and the body to the connection. If the body is `nil`, you should coordinate writing to the stream.
|
|
765
|
+
#
|
|
766
|
+
# The connection will not be persistent after this method is called.
|
|
767
|
+
#
|
|
768
|
+
# @parameter protocol [String] the protocol to upgrade to.
|
|
769
|
+
# @parameter body [Object | Nil] the body to write.
|
|
770
|
+
# @returns [IO] the underlying IO stream.
|
|
771
|
+
#
|
|
772
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:572
|
|
773
|
+
def write_upgrade_body(protocol, body = T.unsafe(nil)); end
|
|
774
|
+
|
|
775
|
+
# Write the appropriate header for connection upgrade.
|
|
776
|
+
#
|
|
777
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:188
|
|
778
|
+
def write_upgrade_header(upgrade); end
|
|
779
|
+
|
|
780
|
+
private
|
|
781
|
+
|
|
782
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:1078
|
|
783
|
+
def close_write_stream; end
|
|
784
|
+
|
|
785
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:1072
|
|
786
|
+
def flush_stream; end
|
|
787
|
+
|
|
788
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:1066
|
|
789
|
+
def write_stream(data); end
|
|
790
|
+
end
|
|
791
|
+
|
|
792
|
+
# The HTTP `CONNECT` method.
|
|
793
|
+
#
|
|
794
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:899
|
|
795
|
+
Protocol::HTTP1::Connection::CONNECT = T.let(T.unsafe(nil), String)
|
|
796
|
+
|
|
797
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:53
|
|
798
|
+
Protocol::HTTP1::Connection::CRLF = T.let(T.unsafe(nil), String)
|
|
799
|
+
|
|
800
|
+
# The HTTP `HEAD` method.
|
|
801
|
+
#
|
|
802
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:896
|
|
803
|
+
Protocol::HTTP1::Connection::HEAD = T.let(T.unsafe(nil), String)
|
|
804
|
+
|
|
805
|
+
# The HTTP/1.0 version string.
|
|
806
|
+
#
|
|
807
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:56
|
|
808
|
+
Protocol::HTTP1::Connection::HTTP10 = T.let(T.unsafe(nil), String)
|
|
809
|
+
|
|
810
|
+
# The HTTP/1.1 version string.
|
|
811
|
+
#
|
|
812
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:59
|
|
813
|
+
Protocol::HTTP1::Connection::HTTP11 = T.let(T.unsafe(nil), String)
|
|
814
|
+
|
|
815
|
+
# The pattern for valid content length values.
|
|
816
|
+
#
|
|
817
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:902
|
|
818
|
+
Protocol::HTTP1::Connection::VALID_CONTENT_LENGTH = T.let(T.unsafe(nil), Regexp)
|
|
819
|
+
|
|
820
|
+
# The specified content length and the given content's length do not match.
|
|
821
|
+
#
|
|
822
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/error.rb:36
|
|
823
|
+
class Protocol::HTTP1::ContentLengthError < ::Protocol::HTTP1::Error; end
|
|
824
|
+
|
|
825
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:49
|
|
826
|
+
Protocol::HTTP1::DEFAULT_MAXIMUM_LINE_LENGTH = T.let(T.unsafe(nil), Integer)
|
|
827
|
+
|
|
828
|
+
# The base class for all HTTP/1.x errors.
|
|
829
|
+
#
|
|
830
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/error.rb:11
|
|
831
|
+
class Protocol::HTTP1::Error < ::Protocol::HTTP::Error; end
|
|
832
|
+
|
|
833
|
+
# HTTP/1.x header parser:
|
|
834
|
+
#
|
|
835
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:40
|
|
836
|
+
Protocol::HTTP1::FIELD_NAME = T.let(T.unsafe(nil), Regexp)
|
|
837
|
+
|
|
838
|
+
# A field value is any string of characters that does not contain a null character, CR, or LF. After reflecting on the RFCs and surveying real implementations, I came to the conclusion that the RFCs are too restrictive. Most servers only check for the presence of null bytes, and obviously CR/LF characters have semantic meaning in the parser. So, I decided to follow this defacto standard, even if I'm not entirely happy with it.
|
|
839
|
+
#
|
|
840
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:43
|
|
841
|
+
Protocol::HTTP1::FIELD_VALUE = T.let(T.unsafe(nil), Regexp)
|
|
842
|
+
|
|
843
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:44
|
|
844
|
+
Protocol::HTTP1::HEADER = T.let(T.unsafe(nil), Regexp)
|
|
845
|
+
|
|
846
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:31
|
|
847
|
+
Protocol::HTTP1::HOST = T.let(T.unsafe(nil), String)
|
|
848
|
+
|
|
849
|
+
# Indicates that the request is invalid for some reason, e.g. syntax error, invalid headers, etc.
|
|
850
|
+
#
|
|
851
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/error.rb:32
|
|
852
|
+
class Protocol::HTTP1::InvalidRequest < ::Protocol::HTTP1::BadRequest; end
|
|
853
|
+
|
|
854
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:29
|
|
855
|
+
Protocol::HTTP1::KEEP_ALIVE = T.let(T.unsafe(nil), String)
|
|
856
|
+
|
|
857
|
+
# The request line was too long.
|
|
858
|
+
#
|
|
859
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/error.rb:19
|
|
860
|
+
class Protocol::HTTP1::LineLengthError < ::Protocol::HTTP1::Error; end
|
|
861
|
+
|
|
862
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:41
|
|
863
|
+
Protocol::HTTP1::OWS = T.let(T.unsafe(nil), Regexp)
|
|
864
|
+
|
|
865
|
+
# The protocol was violated in some way, e.g. trying to write a request while reading a response.
|
|
866
|
+
#
|
|
867
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/error.rb:15
|
|
868
|
+
class Protocol::HTTP1::ProtocolError < ::Protocol::HTTP1::Error; end
|
|
869
|
+
|
|
870
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:37
|
|
871
|
+
Protocol::HTTP1::REQUEST_LINE = T.let(T.unsafe(nil), Regexp)
|
|
872
|
+
|
|
873
|
+
# HTTP/1.x request line parser:
|
|
874
|
+
#
|
|
875
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:35
|
|
876
|
+
Protocol::HTTP1::TOKEN = T.let(T.unsafe(nil), Regexp)
|
|
877
|
+
|
|
878
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:24
|
|
879
|
+
Protocol::HTTP1::TRANSFER_ENCODING = T.let(T.unsafe(nil), String)
|
|
880
|
+
|
|
881
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:32
|
|
882
|
+
Protocol::HTTP1::UPGRADE = T.let(T.unsafe(nil), String)
|
|
883
|
+
|
|
884
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:46
|
|
885
|
+
Protocol::HTTP1::VALID_FIELD_NAME = T.let(T.unsafe(nil), Regexp)
|
|
886
|
+
|
|
887
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:47
|
|
888
|
+
Protocol::HTTP1::VALID_FIELD_VALUE = T.let(T.unsafe(nil), Regexp)
|
|
889
|
+
|
|
890
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/connection.rb:36
|
|
891
|
+
Protocol::HTTP1::VALID_METHOD = T.let(T.unsafe(nil), Regexp)
|
|
892
|
+
|
|
893
|
+
# pkg:gem/protocol-http1#lib/protocol/http1/version.rb:8
|
|
894
|
+
Protocol::HTTP1::VERSION = T.let(T.unsafe(nil), String)
|