module Protocol::HTTP2::Continued
Attributes
continuation[RW]
Public Class Methods
new(*)
click to toggle source
Calls superclass method
# File lib/protocol/http2/continuation_frame.rb, line 26 def initialize(*) super @continuation = nil end
Public Instance Methods
end_headers?()
click to toggle source
# File lib/protocol/http2/continuation_frame.rb, line 32 def end_headers? flag_set?(END_HEADERS) end
pack(data, **options)
click to toggle source
Calls superclass method
# File lib/protocol/http2/continuation_frame.rb, line 68 def pack(data, **options) maximum_size = options[:maximum_size] if maximum_size and data.bytesize > maximum_size clear_flags(END_HEADERS) super(data.byteslice(0, maximum_size), **options) remainder = data.byteslice(maximum_size, data.bytesize-maximum_size) @continuation = ContinuationFrame.new @continuation.pack(remainder, maximum_size: maximum_size) else set_flags(END_HEADERS) super data, **options @continuation = nil end end
read(stream, maximum_frame_size)
click to toggle source
Calls superclass method
# File lib/protocol/http2/continuation_frame.rb, line 36 def read(stream, maximum_frame_size) super unless end_headers? continuation = ContinuationFrame.new continuation.read_header(stream) # We validate the frame type here: unless continuation.valid_type? raise ProtocolError, "Invalid frame type: #{@type}!" end if continuation.stream_id != @stream_id raise ProtocolError, "Invalid stream id: #{continuation.stream_id} for continuation of stream id: #{@stream_id}!" end continuation.read(stream, maximum_frame_size) @continuation = continuation end end
unpack()
click to toggle source
Calls superclass method
# File lib/protocol/http2/continuation_frame.rb, line 89 def unpack if @continuation.nil? super else super + @continuation.unpack end end
write(stream)
click to toggle source
Calls superclass method
# File lib/protocol/http2/continuation_frame.rb, line 58 def write(stream) super if continuation = self.continuation continuation.write(stream) end end