h2_frame
Types
pub type ErrorCode {
NoError
ProtocolError
InternalError
FlowControlError
SettingsTimeout
StreamClosed
FrameSizeError
RefusedStream
Cancel
CompressionError
ConnectError
EnhanceYourCalm
InadequateSecurity
Http11Required
UnknownErrorCode(Int)
}
Constructors
-
NoError -
ProtocolError -
InternalError -
FlowControlError -
SettingsTimeout -
StreamClosed -
FrameSizeError -
RefusedStream -
Cancel -
CompressionError -
ConnectError -
EnhanceYourCalm -
InadequateSecurity -
Http11Required -
UnknownErrorCode(Int)
pub type Frame {
Data(stream_id: Int, end_stream: Bool, data: BitArray)
Headers(
stream_id: Int,
end_stream: Bool,
end_headers: Bool,
priority: option.Option(StreamPriority),
field_block_fragment: BitArray,
)
Priority(
stream_id: Int,
exclusive: Bool,
stream_dependency: Int,
weight: Int,
)
RstStream(stream_id: Int, error_code: ErrorCode)
Settings(ack: Bool, settings: List(Setting))
PushPromise(
stream_id: Int,
end_headers: Bool,
promised_stream_id: Int,
field_block_fragment: BitArray,
)
Ping(ack: Bool, data: BitArray)
Goaway(
last_stream_id: Int,
error_code: ErrorCode,
debug_data: BitArray,
)
WindowUpdate(stream_id: Int, window_size_increment: Int)
Continuation(
stream_id: Int,
end_headers: Bool,
field_block_fragment: BitArray,
)
Unknown(
stream_id: Int,
frame_type: Int,
flags: Int,
data: BitArray,
)
}
Constructors
-
Data(stream_id: Int, end_stream: Bool, data: BitArray) -
Headers( stream_id: Int, end_stream: Bool, end_headers: Bool, priority: option.Option(StreamPriority), field_block_fragment: BitArray, ) -
Priority( stream_id: Int, exclusive: Bool, stream_dependency: Int, weight: Int, ) -
RstStream(stream_id: Int, error_code: ErrorCode) -
Settings(ack: Bool, settings: List(Setting)) -
PushPromise( stream_id: Int, end_headers: Bool, promised_stream_id: Int, field_block_fragment: BitArray, ) -
Ping(ack: Bool, data: BitArray) -
Goaway( last_stream_id: Int, error_code: ErrorCode, debug_data: BitArray, ) -
WindowUpdate(stream_id: Int, window_size_increment: Int) -
Continuation( stream_id: Int, end_headers: Bool, field_block_fragment: BitArray, ) -
Unknown( stream_id: Int, frame_type: Int, flags: Int, data: BitArray, )
pub type Setting {
HeaderTableSize(Int)
EnablePush(Int)
MaxConcurrentStreams(Int)
InitialWindowSize(Int)
MaxFrameSize(Int)
MaxHeaderListSize(Int)
UnknownSetting(id: Int, value: Int)
}
Constructors
-
HeaderTableSize(Int) -
EnablePush(Int) -
MaxConcurrentStreams(Int) -
InitialWindowSize(Int) -
MaxFrameSize(Int) -
MaxHeaderListSize(Int) -
UnknownSetting(id: Int, value: Int)
pub type StreamPriority {
StreamPriority(
exclusive: Bool,
stream_dependency: Int,
weight: Int,
)
}
Constructors
-
StreamPriority( exclusive: Bool, stream_dependency: Int, weight: Int, )
Values
pub fn encode_continuation(
stream_id stream_id: Int,
end_headers end_headers: Bool,
field_block_fragment field_block_fragment: BitArray,
) -> Result(BitArray, FrameError)
pub fn encode_data(
stream_id stream_id: Int,
end_stream end_stream: Bool,
data data: BitArray,
padding padding: option.Option(Int),
) -> Result(BitArray, FrameError)
pub fn encode_error_code(error_code: ErrorCode) -> Int
pub fn encode_goaway(
last_stream_id last_stream_id: Int,
error_code error_code: ErrorCode,
debug_data debug_data: BitArray,
) -> BitArray
pub fn encode_headers(
stream_id stream_id: Int,
end_stream end_stream: Bool,
end_headers end_headers: Bool,
priority priority: option.Option(StreamPriority),
field_block_fragment field_block_fragment: BitArray,
padding padding: option.Option(Int),
) -> Result(BitArray, FrameError)
pub fn encode_ping(
ack ack: Bool,
data data: BitArray,
) -> Result(BitArray, FrameError)
pub fn encode_priority(
stream_id stream_id: Int,
exclusive exclusive: Bool,
stream_dependency stream_dependency: Int,
weight weight: Int,
) -> Result(BitArray, FrameError)
pub fn encode_push_promise(
stream_id stream_id: Int,
end_headers end_headers: Bool,
promised_stream_id promised_stream_id: Int,
field_block_fragment field_block_fragment: BitArray,
padding padding: option.Option(Int),
) -> Result(BitArray, FrameError)
pub fn encode_rst_stream(
stream_id stream_id: Int,
error_code error_code: ErrorCode,
) -> Result(BitArray, FrameError)
pub fn encode_settings(
ack ack: Bool,
settings settings: List(Setting),
) -> Result(BitArray, FrameError)
pub fn encode_unknown(
frame_type_code frame_type_code: Int,
stream_id stream_id: Int,
flags flags: Int,
data data: BitArray,
) -> BitArray
pub fn encode_window_update(
stream_id stream_id: Int,
window_size_increment window_size_increment: Int,
) -> Result(BitArray, FrameError)
pub fn parse(
data: BitArray,
) -> Result(#(Frame, BitArray), FrameError)
Parses a complete HTTP/2 frame from binary data. Returns the frame and any remaining bytes that follow the frame.
pub fn parse_error_code(code: Int) -> ErrorCode