1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
package Protocol::HTTP2::Frame::Continuation;
use strict;
use warnings;
use Protocol::HTTP2::Constants qw(:flags :errors);
use Protocol::HTTP2::Trace qw(tracer);
sub decode {
my ( $con, $buf_ref, $buf_offset, $length ) = @_;
my $frame_ref = $con->decode_context->{frame};
# Protocol errors
if (
# CONTINUATION frames MUST be associated with a stream
$frame_ref->{stream} == 0
)
{
$con->error(PROTOCOL_ERROR);
return undef;
}
$con->stream_header_block( $frame_ref->{stream},
substr( $$buf_ref, $buf_offset, $length ) );
# Stream header block complete
$con->stream_headers_done( $frame_ref->{stream} )
or return undef
if $frame_ref->{flags} & END_HEADERS;
return $length;
}
sub encode {
my ( $con, $flags_ref, $stream, $data_ref ) = @_;
return $$data_ref;
}
1;
|