class
HTTP2::Stream
- HTTP2::Stream
- Reference
- Object
Defined in:
stream.crInstance Method Summary
- #==(other : Stream)
-
#==(other)
Returns
false(other can only be aValuehere). -
#active? : Bool
Returns true if the stream is in an active
#state, that is OPEN or HALF_CLOSED (local or remote). -
#data : Data
Received body.
-
#headers : HTTP::Headers
Received HTTP headers.
-
#id : Int32
The stream identifier.
- #priority : Priority
- #priority=(priority : Priority)
-
#send_data(data : String, flags : Frame::Flags = Frame::Flags::None) : Nil
Writes data to the stream.
-
#send_data(data : Bytes, flags : Frame::Flags = Frame::Flags::None) : Nil
ditto
-
#send_headers(headers : HTTP::Headers, flags : Frame::Flags = Frame::Flags::None) : Nil
Sends
HTTP::Headersas part of a response or request. -
#send_priority : Nil
Sends a PRIORITY frame for the current
#prioritydefinition. -
#send_push_promise(headers : HTTP::Headers, flags : Frame::Flags = Frame::Flags::None) : Stream | Nil
Sends
HTTP::Headersas a server-push request. -
#send_rst_stream(error_code : Error::Code) : Nil
Closes the stream.
- #state : State
-
#trailers? : HTTP::Headers | Nil
Received trailing HTTP headers, or
nilif none have been received (yet).
Instance Method Detail
Returns false (other can only be a Value here).
Returns true if the stream is in an active #state, that is OPEN or
HALF_CLOSED (local or remote).
Received body.
Implemented as a circular buffer that acts as an IO. Reading a request
body will block if the buffer is emptied, and will be resumed when the
connected peer sends more DATA frames.
See Data for more details.
Received HTTP headers. In a server context they are headers of the received client request; in a client context they are headers of the received server response.
The stream identifier. Odd-numbered for client streams (requests), even-numbered for server initiated streams (server-push).
Writes data to the stream.
This may be part of a request body (client context), or a response body (server context).
This will send one or many DATA frames, respecting SETTINGS_MAX_FRAME_SIZE as defined by the remote peer, as well as available window sizes for the stream and the connection, exhausting them as much as possible.
This will block the current fiber if data is too big than allowed by any window size (stream or connection). The fiber will be eventually resumed when the remote peer sends a WINDOW_UPDATE frame to increment window sizes.
Eventually returns when data has been fully sent.
Sends HTTP::Headers as part of a response or request.
This will send a HEADERS frame, possibly followed by CONTINUATION frames.
The Frame::Flags::END_HEADERS flag will be automatically set on the last
part; hence you can't send headers multiple times.
Sends a PRIORITY frame for the current #priority definition.
This may only be sent by a client, to hint the server to prioritize some streams over others. The server may or may not respect the expected priorities.
Sends HTTP::Headers as a server-push request.
Creates a server initiated stream (even numbered) as the promised stream, that is the stream that shall be used to push the server-pushed response headers and data.
This will send a PUSH_PROMISE frame to the expected stream. If the client doesn't want the server-push or already has it cached, it may refuse the server-push request by closing the promised stream immediately.
Returns the promised stream, or nil if the client configured
SETTINGS_ENABLE_PUSH to be false (true by default).
You may send multiple PUSH_PROMISE frames on an expected stream, but you may send only one per resource to push.
Closes the stream. Optionally reporting an error status.
Received trailing HTTP headers, or nil if none have been received (yet).