| 1 | package Protocol::HTTP2::Frame::Rst_stream; | ||||||||||
| 2 | 13 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 13 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 13 | ▶ | use Protocol::HTTP2::Constants qw(const_name :flags :errors); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 13 | ▶ | use Protocol::HTTP2::Trace qw(tracer); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 5 | ▶ | sub decode { | ||||||||
|
Subroutine
decode: called CC=3 SCAR=13.3
Pod
undocumented
| |||||||||||
| 8 | 5 | my ( $con, $buf_ref, $buf_offset, $length ) = @_; | |||||||||
| 9 | 5 | my $frame_ref = $con->decode_context->{frame}; | |||||||||
| 10 | |||||||||||
| 11 | # RST_STREAM associated with stream | ||||||||||
| 12 | 5 | ▶ | if ( $frame_ref->{stream} == 0 ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 13 | 0 | tracer->error("Received reset stream with stream id 0"); | |||||||||
| 14 | 0 | $con->error(PROTOCOL_ERROR); | |||||||||
| 15 | 0 | return undef; | |||||||||
| 16 | } | ||||||||||
| 17 | |||||||||||
| 18 | 5 | ▶ | if ( $length != 4 ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 19 | 0 | tracer->error("Received reset stream with invalid length $length"); | |||||||||
| 20 | 0 | $con->error(FRAME_SIZE_ERROR); | |||||||||
| 21 | 0 | return undef; | |||||||||
| 22 | } | ||||||||||
| 23 | |||||||||||
| 24 | 5 | my $code = unpack( 'N', substr( $$buf_ref, $buf_offset, 4 ) ); | |||||||||
| 25 | |||||||||||
| 26 | 5 | tracer->debug( "Receive reset stream with error code " | |||||||||
| 27 | . const_name( "errors", $code ) | ||||||||||
| 28 | . "\n" ); | ||||||||||
| 29 | 5 | $con->stream_reset( $frame_ref->{stream}, $code ); | |||||||||
| 30 | |||||||||||
| 31 | 5 | return $length; | |||||||||
| 32 | } | ||||||||||
| 33 | |||||||||||
| 34 | 5 | ▶ | sub encode { | ||||||||
|
Subroutine
encode: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 35 | 5 | my ( $con, $flags_ref, $stream, $data ) = @_; | |||||||||
| 36 | 5 | $con->stream_reset( $stream, $data ); | |||||||||
| 37 | 5 | return pack 'N', $data; | |||||||||
| 38 | } | ||||||||||
| 39 | |||||||||||
| 40 | 13 | 1; | |||||||||