Class: Quicsilver::Protocol::FrameParser
- Inherits:
-
Object
- Object
- Quicsilver::Protocol::FrameParser
- Defined in:
- lib/quicsilver/protocol/frame_parser.rb
Overview
Base class for HTTP/3 request and response frame parsing.
Handles the shared frame walking loop, HEADERS→DATA→HEADERS ordering, trailer parsing, body accumulation, and size limit enforcement.
Subclasses implement:
- parse_headers(payload) — decode the first HEADERS frame
Direct Known Subclasses
Constant Summary collapse
- DEFAULT_DECODER =
Frame types forbidden on request streams — use hash for O(1) lookup Static-only QPACK decoder (no dynamic table). Used by default. Inject a custom decoder via decoder: kwarg for dynamic QPACK support.
Qpack::HeaderBlockDecoder.default
- CONTROL_ONLY_SET =
Protocol::CONTROL_ONLY_FRAMES.each_with_object({}) { |f, h| h[f] = true }.freeze
- EMPTY_BODY =
StringIO.new("".b).tap { |io| io.set_encoding(Encoding::ASCII_8BIT) }
Instance Attribute Summary collapse
-
#bytes_consumed ⇒ Object
readonly
Returns the value of attribute bytes_consumed.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#trailers ⇒ Object
readonly
Returns the value of attribute trailers.
Instance Method Summary collapse
- #body ⇒ Object
- #frames ⇒ Object
-
#initialize(decoder:, max_body_size: nil, max_header_size: nil, max_header_count: nil, max_frame_payload_size: nil) ⇒ FrameParser
constructor
A new instance of FrameParser.
Constructor Details
#initialize(decoder:, max_body_size: nil, max_header_size: nil, max_header_count: nil, max_frame_payload_size: nil) ⇒ FrameParser
Returns a new instance of FrameParser.
32 33 34 35 36 37 38 39 40 |
# File 'lib/quicsilver/protocol/frame_parser.rb', line 32 def initialize(decoder:, max_body_size: nil, max_header_size: nil, max_header_count: nil, max_frame_payload_size: nil) @decoder = decoder @max_body_size = max_body_size @max_header_size = max_header_size @max_header_count = max_header_count @max_frame_payload_size = max_frame_payload_size @headers = {} @trailers = {} end |
Instance Attribute Details
#bytes_consumed ⇒ Object (readonly)
Returns the value of attribute bytes_consumed.
26 27 28 |
# File 'lib/quicsilver/protocol/frame_parser.rb', line 26 def bytes_consumed @bytes_consumed end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
26 27 28 |
# File 'lib/quicsilver/protocol/frame_parser.rb', line 26 def headers @headers end |
#trailers ⇒ Object (readonly)
Returns the value of attribute trailers.
26 27 28 |
# File 'lib/quicsilver/protocol/frame_parser.rb', line 26 def trailers @trailers end |
Instance Method Details
#body ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/quicsilver/protocol/frame_parser.rb', line 42 def body if @body @body.rewind @body elsif @cached_body_str @body = StringIO.new(@cached_body_str) @body.set_encoding(Encoding::ASCII_8BIT) @body else EMPTY_BODY end end |
#frames ⇒ Object
28 29 30 |
# File 'lib/quicsilver/protocol/frame_parser.rb', line 28 def frames @frames || [] end |