| 1 | package Unblock::HTTP2::Client; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 30 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 30 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 30 | ▶ | use Carp qw(croak); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 30 | ▶ | use Scalar::Util qw(weaken); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 30 | ▶ | use parent 'Unblock::HTTP2::_Connection'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 30 | ▶ | use Unblock::HTTP2::_Headers; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 30 | ▶ | use Unblock::HTTP2::Transaction; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 30 | ▶ | use Uniform::HTTP::Request; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 30 | our $VERSION = '0.13'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 30 | ▶ | use constant { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 30 | H2_DATA => 0, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | H2_HEADERS => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | H2_GOAWAY => 7, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | H2_END_STREAM => 0x1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | H2_PROTOCOL_ERROR => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | H2_INTERNAL_ERROR => 2, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | H2_CANCEL => 8, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | H2_ENHANCE_YOUR_CALM => 11, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 30 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 30 | my $BODY_HIGH_WATER = 65_536; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 30 | my $BODY_LOW_WATER = 32_768; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 58 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=21 SCAR=34.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 58 | my ($class, %option) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 58 | my $transport = delete $option{transport}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 58 | my %receive = $class->_receive_options(\%option); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 58 | my %callbacks; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 58 | for my $name (qw( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | on_settings on_settings_ack on_ping on_ping_ack on_invalid_frame | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | )) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 290 | ▶ | next unless exists $option{$name}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 7 | my $callback = delete $option{$name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 7 | ▶ | croak "new(): $name must be a coderef" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $callback and ref $callback ne "CODE"
MC/DC0%0/2
defined $callback and ref $callback ne "CODE"
defined $callback
ref $callback ne "CODE"
Truth table33%1/3
A and B
A= defined $callbackB= ref $callback ne "CODE"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | if defined($callback) && ref($callback) ne 'CODE'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 7 | ▶ | $callbacks{$name} = $callback if $callback; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | my $settings = exists($option{settings}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | ? delete($option{settings}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 58 | ▶ | : {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 58 | ▶ | croak 'new(): settings must be a hash reference' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | unless ref($settings) eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | my $max_active_transactions = exists($option{max_active_transactions}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | ? delete($option{max_active_transactions}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 58 | ▶ | : 100; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | my $max_header_list_size = exists($option{max_header_list_size}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | ? delete($option{max_header_list_size}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 58 | ▶ | : 65_536; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 58 | ▶ | croak 'new(): max_active_transactions must be a positive integer' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
defined $max_active_transactions and not ref $max_active_transactions and $max_active_transactions =~ /\A[0-9]+\z/ and $max_active_transactions > 0
defined $max_active_transactions and not ref $max_active_transactions and $max_active_transactions =~ /\A[0-9]+\z/
defined $max_active_transactions and not ref $max_active_transactions
MC/DC0%0/4
defined $max_active_transactions and not ref $max_active_transactions and $max_active_transactions =~ /\A[0-9]+\z/ and $max_active_transactions > 0
defined $max_active_transactions
not ref $max_active_transactions
$max_active_transactions =~ /\A[0-9]+\z/
$max_active_transactions > 0
Truth table20%1/5
A and not(B) and C and D
A= defined $max_active_transactionsB= not ref $max_active_transactionsC= $max_active_transactions =~ /\A[0-9]+\z/D= $max_active_transactions > 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | unless defined($max_active_transactions) && !ref($max_active_transactions) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | && $max_active_transactions =~ /\A[0-9]+\z/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | && $max_active_transactions > 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 58 | ▶ | croak 'new(): max_header_list_size must be a positive integer' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
defined $max_header_list_size and not ref $max_header_list_size and $max_header_list_size =~ /\A[0-9]+\z/ and $max_header_list_size > 0
defined $max_header_list_size and not ref $max_header_list_size and $max_header_list_size =~ /\A[0-9]+\z/
defined $max_header_list_size and not ref $max_header_list_size
MC/DC0%0/4
defined $max_header_list_size and not ref $max_header_list_size and $max_header_list_size =~ /\A[0-9]+\z/ and $max_header_list_size > 0
defined $max_header_list_size
not ref $max_header_list_size
$max_header_list_size =~ /\A[0-9]+\z/
$max_header_list_size > 0
Truth table20%1/5
A and not(B) and C and D
A= defined $max_header_list_sizeB= not ref $max_header_list_sizeC= $max_header_list_size =~ /\A[0-9]+\z/D= $max_header_list_size > 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | unless defined($max_header_list_size) && !ref($max_header_list_size) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | && $max_header_list_size =~ /\A[0-9]+\z/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | && $max_header_list_size > 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 58 | ▶ | croak 'new(): unknown options: ' . join(', ', sort keys %option) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | if %option; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 58 | require Unblock::HTTP2::_nghttp2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 58 | ▶ | croak 'new(): nghttp2 library is unavailable' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | unless Unblock::HTTP2::_nghttp2->available; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 58 | my $self = bless { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | draining => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | max_active_transactions => 0 + $max_active_transactions, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | max_header_list_size => 0 + $max_header_list_size, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | receive => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | providers => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | peer_goaway => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | }, $class; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 58 | my $weak = $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 58 | weaken($weak); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | my $session = Unblock::HTTP2::_nghttp2::Session->new_client( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | max_header_list_size => $self->{max_header_list_size}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | callbacks => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 45 | ▶ | on_begin_headers => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 45 | ▶ | my $self = $weak or return 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 45 | return $self->_on_begin_headers(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 218 | ▶ | on_frame_recv => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 218 | ▶ | my $self = $weak or return 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 218 | return $self->_on_frame_recv(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 49 | ▶ | on_data_chunk_recv => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 49 | ▶ | my $self = $weak or return 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 49 | return $self->_on_data_chunk_recv(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 50 | ▶ | on_stream_close => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 50 | ▶ | my $self = $weak or return 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 50 | return $self->_on_stream_close(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 1 | ▶ | on_invalid_frame => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 1 | ▶ | my $self = $weak or return 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 1 | return $self->_on_invalid_frame(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 58 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 58 | $self->_initialize_connection( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | $session, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | %receive, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | role => 'client', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | callbacks => \%callbacks, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | transport => $transport, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | my %initial_settings = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | max_concurrent_streams => 100, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | max_header_list_size => $self->{max_header_list_size}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 58 | enable_push => 0, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | no_rfc7540_priorities => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | %$settings, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 58 | $self->_submit_settings('new()', \%initial_settings); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 58 | ▶ | $self->_transport_sync if $self->{transport_attached}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 58 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 2 | ▶ | sub draining { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
draining: called CC=2 SCAR=7.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 2 | ▶ | return $_[0]{draining} ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 3 | ▶ | sub peer_goaway { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
peer_goaway: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 3 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 3 | ▶ | return unless $self->{peer_goaway}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 3 | return { %{ $self->{peer_goaway} } }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 1 | ▶ | sub drain { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
drain: called CC=3 SCAR=12.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 1 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 1 | ▶ | return $self if $self->is_closed || $self->{draining}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->is_closed or $self->{"draining"}
MC/DC0%0/2
$self->is_closed or $self->{"draining"}
$self->is_closed
$self->{"draining"}
Truth table33%1/3
A or B
A= $self->is_closedB= $self->{"draining"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 1 | return $self->goaway(error_code => 0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 67 | ▶ | sub can_open_transaction { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
can_open_transaction: called CC=5 SCAR=16.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 67 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 67 | ▶ | return 0 if $self->is_closed || $self->{draining}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->is_closed or $self->{"draining"}
MC/DC50%1/2
$self->is_closed or $self->{"draining"}
$self->is_closed
$self->{"draining"}
Truth table66%2/3
A or B
A= $self->is_closedB= $self->{"draining"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 64 | my $limit = $self->{max_active_transactions}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 64 | my $peer_limit = $self->peer_setting('max_concurrent_streams'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 64 | ▶ | $limit = $peer_limit if $peer_limit < $limit; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 64 | ▶ | return $self->transaction_count < $limit ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 61 | ▶ | sub request { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
request: called CC=43 SCAR=41.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 61 | my ($self, @arg) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 61 | my ($request, %option); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 61 | ▶ | if (@arg && ref($arg[0])) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@arg and ref $arg[0]
MC/DC50%1/2
@arg and ref $arg[0]
@arg
ref $arg[0]
Truth table66%2/3
A and B
A= @argB= ref $arg[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 44 | $request = shift @arg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 44 | ▶ | croak 'request(): options must be key/value pairs' if @arg % 2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 44 | %option = @arg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 17 | ▶ | croak 'request(): fields must be key/value pairs' if @arg % 2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 17 | my %field = @arg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 17 | for my $name (qw( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | stream_body on_response on_body on_data on_finish on_complete on_error | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | on_informational on_drain | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | )) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 153 | ▶ | $option{$name} = delete $field{$name} if exists $field{$name}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 17 | $request = Uniform::HTTP::Request->new(%field); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 61 | ▶ | croak 'request(): connection is closed' if $self->is_closed; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 61 | ▶ | croak 'request(): connection cannot accept another transaction' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | unless $self->can_open_transaction; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 59 | my $native_message = Unblock::HTTP2::_Headers->native_message($request); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 59 | ▶ | croak 'request(): requires the Uniform HTTP request contract' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$native_message or Unblock::HTTP2::_Headers::_request_contract($request)
MC/DC0%0/2
$native_message or Unblock::HTTP2::_Headers::_request_contract($request)
$native_message
Unblock::HTTP2::_Headers::_request_contract($request)
Truth table33%1/3
A or B
A= $native_messageB= Unblock::HTTP2::_Headers::_request_contract($request)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | unless $native_message | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | || Unblock::HTTP2::_Headers::_request_contract($request); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 59 | ▶ | if (defined($request->protocol) && length($request->protocol)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $request->protocol and length $request->protocol
MC/DC50%1/2
defined $request->protocol and length $request->protocol
defined $request->protocol
length $request->protocol
Truth table66%2/3
A and B
A= defined $request->protocolB= length $request->protocol
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 2 | my $enabled = $self->peer_setting('enable_connect_protocol'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 2 | ▶ | croak 'request(): peer has not enabled Extended CONNECT' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | unless $enabled == 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | my $stream_body = exists($option{stream_body}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | ? delete($option{stream_body}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 58 | ▶ | : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 58 | ▶ | croak 'request(): stream_body must be zero or one' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
not defined $stream_body or ref $stream_body or not "$stream_body" =~ /\A[01]\z/
not defined $stream_body or ref $stream_body
MC/DC0%0/3
not defined $stream_body or ref $stream_body or not "$stream_body" =~ /\A[01]\z/
not defined $stream_body
ref $stream_body
not "$stream_body" =~ /\A[01]\z/
Truth table25%1/4
not(A) or B or not(C)
A= not defined $stream_bodyB= ref $stream_bodyC= not "$stream_body" =~ /\A[01]\z/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | if !defined($stream_body) || ref($stream_body) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | || "$stream_body" !~ /\A[01]\z/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 58 | ▶ | $stream_body = $stream_body ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 58 | my %callbacks; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 58 | for my $name (qw( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | on_response on_body on_data on_finish on_complete on_error on_informational on_drain | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | )) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 464 | ▶ | next unless exists $option{$name}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 99 | my $callback = delete $option{$name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 99 | ▶ | croak "request(): $name must be a coderef" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $callback and ref $callback ne "CODE"
MC/DC0%0/2
defined $callback and ref $callback ne "CODE"
defined $callback
ref $callback ne "CODE"
Truth table33%1/3
A and B
A= defined $callbackB= ref $callback ne "CODE"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | if defined($callback) && ref($callback) ne 'CODE'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 99 | ▶ | $callbacks{$name} = $callback if $callback; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | croak 'request(): on_data cannot be combined with on_body' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 58 | ▶ | if $callbacks{on_data} && $callbacks{on_body}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$callbacks{"on_data"} and $callbacks{"on_body"}
MC/DC0%0/2
$callbacks{"on_data"} and $callbacks{"on_body"}
$callbacks{"on_data"}
$callbacks{"on_body"}
Truth table33%1/3
A and B
A= $callbacks{"on_data"}B= $callbacks{"on_body"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | croak 'request(): buffered reception cannot be combined with on_body' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 58 | ▶ | if $self->{receive_body} eq 'buffered' && $callbacks{on_body}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->{"receive_body"} eq "buffered" and $callbacks{"on_body"}
MC/DC0%0/2
$self->{"receive_body"} eq "buffered" and $callbacks{"on_body"}
$self->{"receive_body"} eq "buffered"
$callbacks{"on_body"}
Truth table66%2/3
A and B
A= $self->{"receive_body"} eq "buffered"B= $callbacks{"on_body"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 58 | ▶ | croak 'request(): unknown options: ' . join(', ', sort keys %option) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | if %option; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | croak 'request(): on_drain requires stream_body' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 58 | ▶ | if $callbacks{on_drain} && !$stream_body; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$callbacks{"on_drain"} and not $stream_body
MC/DC0%0/2
$callbacks{"on_drain"} and not $stream_body
$callbacks{"on_drain"}
not $stream_body
Truth table66%2/3
A and not(B)
A= $callbacks{"on_drain"}B= not $stream_body
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 58 | ▶ | croak 'request(): stream_body cannot be combined with a buffered body' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$stream_body and $request->has_buffered_body
MC/DC0%0/2
$stream_body and $request->has_buffered_body
$stream_body
$request->has_buffered_body
Truth table66%2/3
A and B
A= $stream_bodyB= $request->has_buffered_body
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | if $stream_body && $request->has_buffered_body; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 58 | ▶ | my $block = $native_message | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | ? undef | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | : Unblock::HTTP2::_Headers->request_headers($request); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 58 | my $trailers = Unblock::HTTP2::_Headers->trailer_fields( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 'request()', $request, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 58 | my ($provider, $body); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 58 | ▶ | if ($stream_body || @$trailers) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition100%3/3
$stream_body or @$trailers
MC/DC100%2/2
$stream_body or @$trailers
$stream_body
@$trailers
Truth table100%3/3
A or B
A= $stream_bodyB= @$trailers
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 11 | $provider = { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | queue => '', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | eof => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | blocked => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | stream_id => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | trailers => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | trailer_submitted => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 11 | ▶ | if (!$stream_body) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 1 | ▶ | $provider->{queue} = $request->has_buffered_body | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | ? $request->body | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | : ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 1 | $provider->{eof} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 1 | ▶ | $provider->{trailers} = $trailers if @$trailers; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 11 | my $weak_self = $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 11 | weaken($weak_self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 31 | ▶ | $body = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 31 | ▶ | my $self = $weak_self or return ('', 1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 31 | return $self->_provide_body($provider, @_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 11 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | elsif ($request->has_buffered_body) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 12 | $body = $request->body; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | my $stream_id = $native_message | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | ? $self->{session}->_submit_request_uniform_xs($native_message, $body) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 58 | ▶ | : $self->{session}->_submit_request_xs($block, $body); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 58 | my $transaction = Unblock::HTTP2::Transaction->_new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | connection => $self, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | stream_id => $stream_id, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | request => $request, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | callbacks => \%callbacks, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 58 | $self->_register_transaction($transaction); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 58 | $self->{receive}{$stream_id} = { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | response => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | response_done => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 58 | ▶ | if ($provider) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 11 | $provider->{stream_id} = $stream_id; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 11 | $self->{providers}{$stream_id} = $provider; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 58 | ▶ | $self->_transport_sync if $self->{transport_attached}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 58 | return $transaction; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 31 | ▶ | sub _provide_body { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_provide_body: called CC=14 SCAR=26.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 31 | my ($self, $provider, $stream_id, $max_length) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 31 | ▶ | if (!length($provider->{queue})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 9 | ▶ | if ($provider->{eof}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 1 | ▶ | if ($provider->{trailers} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$provider->{"trailers"} and not $provider->{"trailer_submitted"}
MC/DC0%0/2
$provider->{"trailers"} and not $provider->{"trailer_submitted"}
$provider->{"trailers"}
not $provider->{"trailer_submitted"}
Truth table33%1/3
A and not(B)
A= $provider->{"trailers"}B= not $provider->{"trailer_submitted"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | && !$provider->{trailer_submitted}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 0 | $self->_submit_provider_trailers($provider); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 0 | return ('', 1, 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 1 | return ('', 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 8 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | my $take = length($provider->{queue}) < $max_length | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | ? length($provider->{queue}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 22 | ▶ | : $max_length; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 22 | my $chunk = substr($provider->{queue}, 0, $take, ''); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 22 | ▶ | my $eof = $provider->{eof} && !length($provider->{queue}) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$provider->{"eof"} and not length $provider->{"queue"}
MC/DC100%2/2
$provider->{"eof"} and not length $provider->{"queue"}
$provider->{"eof"}
not length $provider->{"queue"}
Truth table100%3/3
A and not(B)
A= $provider->{"eof"}B= not length $provider->{"queue"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 22 | my $no_end_stream = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 22 | ▶ | if ($eof && $provider->{trailers} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$eof and $provider->{"trailers"} and not $provider->{"trailer_submitted"}
$eof and $provider->{"trailers"}
MC/DC66%2/3
$eof and $provider->{"trailers"} and not $provider->{"trailer_submitted"}
$eof
$provider->{"trailers"}
not $provider->{"trailer_submitted"}
Truth table75%3/4
A and B and not(C)
A= $eofB= $provider->{"trailers"}C= not $provider->{"trailer_submitted"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | && !$provider->{trailer_submitted}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 3 | $self->_submit_provider_trailers($provider); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 3 | $no_end_stream = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 22 | ▶ | if ($provider->{blocked} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$provider->{"blocked"} and length $provider->{"queue"} < $BODY_LOW_WATER
MC/DC100%2/2
$provider->{"blocked"} and length $provider->{"queue"} < $BODY_LOW_WATER
$provider->{"blocked"}
length $provider->{"queue"} < $BODY_LOW_WATER
Truth table100%3/3
A and B
A= $provider->{"blocked"}B= length $provider->{"queue"} < $BODY_LOW_WATER
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | && length($provider->{queue}) < $BODY_LOW_WATER) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 2 | $provider->{blocked} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 2 | $self->_queue_drain($provider->{stream_id}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 22 | ▶ | return $no_end_stream | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | ? ($chunk, $eof, 1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | : ($chunk, $eof); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 3 | ▶ | sub _submit_provider_trailers { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_submit_provider_trailers: called CC=3 SCAR=11.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 3 | my ($self, $provider) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 3 | ▶ | return if $provider->{trailer_submitted}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | $self->{session}->submit_trailer( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | $provider->{stream_id}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 3 | ▶ | headers => $provider->{trailers} || [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$provider->{'trailers'} || []
MC/DC0%0/1
$provider->{'trailers'} || []
$provider->{'trailers'}
Truth table50%1/2
A
A= $provider->{'trailers'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 3 | $provider->{trailer_submitted} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 3 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 45 | ▶ | sub _on_begin_headers { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_on_begin_headers: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 45 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 1 | ▶ | sub _on_invalid_frame { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_on_invalid_frame: called CC=3 SCAR=11.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 1 | my ($self, $frame, $lib_error_code) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 1 | ▶ | my $copy = ref($frame) eq 'HASH' ? { %$frame } : {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 1 | ▶ | $self->_invoke_control_callback( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$lib_error_code || 0
MC/DC0%0/1
$lib_error_code || 0
$lib_error_code
Truth table50%1/2
A
A= $lib_error_code
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 'on_invalid_frame', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | $copy, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 0 + ($lib_error_code || 0), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 1 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 218 | ▶ | sub _on_frame_recv { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_on_frame_recv: called CC=32 SCAR=39.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 218 | my ($self, $frame) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 218 | ▶ | return 0 if $self->_handle_settings_frame($frame); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 119 | ▶ | return 0 if $self->_handle_ping_frame($frame); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 116 | ▶ | if (($frame->{type} // -1) == H2_GOAWAY) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$frame->{"type"} // -1
MC/DC0%0/1
$frame->{"type"} // -1
$frame->{"type"}
Truth table50%1/2
A
A= $frame->{"type"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 3 | $self->{draining} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | $self->{peer_goaway} = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | last_stream_id => 0 + ($frame->{last_stream_id} // 0), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | error_code => 0 + ($frame->{error_code} // 0), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | debug_data => defined($frame->{debug_data}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 3 | ▶ | ? "$frame->{debug_data}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%2/4
$frame->{"last_stream_id"} // 0
$frame->{"error_code"} // 0
MC/DC0%0/1
$frame->{"last_stream_id"} // 0
$frame->{"last_stream_id"}
MC/DC0%0/1
$frame->{"error_code"} // 0
$frame->{"error_code"}
Truth table50%1/2
A
A= $frame->{"last_stream_id"}
Truth table50%1/2
A
A= $frame->{"error_code"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | : '', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 3 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 113 | ▶ | my $stream_id = $frame->{stream_id} || 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$frame->{'stream_id'} || 0
MC/DC100%1/1
$frame->{'stream_id'} || 0
$frame->{'stream_id'}
Truth table100%2/2
A
A= $frame->{'stream_id'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 113 | ▶ | return 0 unless $stream_id; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | 111 | ▶ | my $state = $self->{receive}{$stream_id} or return 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 110 | ▶ | my $transaction = $self->transaction_for_stream_id($stream_id) or return 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | 110 | ▶ | if (($frame->{type} // -1) == H2_HEADERS) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$frame->{"type"} // -1
MC/DC0%0/1
$frame->{"type"} // -1
$frame->{"type"}
Truth table50%1/2
A
A= $frame->{"type"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 45 | ▶ | if (defined $frame->{header_error}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | $self->_stream_failure( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | $stream_id, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | "$frame->{header_error}", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | $frame->{header_error_code}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 0 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 45 | ▶ | if (!$state->{response}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 43 | my $response = $frame->{uniform_message}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 43 | ▶ | if (!$response) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 0 | $self->_stream_failure( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | $stream_id, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 'HTTP/2 response header block did not produce a Uniform response', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | 43 | my $status = $response->status; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | 43 | ▶ | if ($status >= 100 && $status < 200) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$status >= 100 and $status < 200
MC/DC50%1/2
$status >= 100 and $status < 200
$status >= 100
$status < 200
Truth table66%2/3
A and B
A= $status >= 100B= $status < 200
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 3 | my $result = $transaction->_invoke( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 'on_informational', $response, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 3 | ▶ | $self->_stream_failure($stream_id, "$result") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | unless $result eq '1'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | 3 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | 40 | $state->{response} = $response; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | 40 | $transaction->_set_response($response); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | 40 | my $result = $transaction->_invoke('on_response', $response); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 40 | ▶ | if ($result ne '1') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 0 | $self->_stream_failure($stream_id, "$result"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 40 | ▶ | if (($frame->{flags} || 0) & H2_END_STREAM) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$frame->{'flags'} || 0
MC/DC0%0/1
$frame->{'flags'} || 0
$frame->{'flags'}
Truth table50%1/2
A
A= $frame->{'flags'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 2 | $self->_finish_response($stream_id); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | 40 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | 2 | ▶ | if ($frame->{uniform_message}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | 0 | $self->_stream_failure( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | $stream_id, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | 'HTTP/2 trailing HEADERS must not contain :status', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | H2_PROTOCOL_ERROR, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | 2 | ▶ | if (!(($frame->{flags} || 0) & H2_END_STREAM)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$frame->{'flags'} || 0
MC/DC0%0/1
$frame->{'flags'} || 0
$frame->{'flags'}
Truth table50%1/2
A
A= $frame->{'flags'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 0 | $self->_stream_failure( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | $stream_id, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 'HTTP/2 trailing HEADERS must end the stream', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | 2 | my $ok = eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | Unblock::HTTP2::_Headers->apply_trailers( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | $state->{response}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 2 | ▶ | $frame->{native_headers} || [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$frame->{'native_headers'} || []
MC/DC0%0/1
$frame->{'native_headers'} || []
$frame->{'native_headers'}
Truth table50%1/2
A
A= $frame->{'native_headers'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | 2 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | 2 | ▶ | if (!$ok) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | 0 | $self->_stream_failure($stream_id, "$@"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | 2 | $self->_finish_response($stream_id); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | 2 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | 65 | ▶ | if (($frame->{type} // -1) == H2_DATA | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition85%6/7
($frame->{"type"} // -1) == 0 and ($frame->{"flags"} || 0) & 1
$frame->{"type"} // -1
$frame->{'flags'} || 0
MC/DC50%1/2
($frame->{"type"} // -1) == 0 and ($frame->{"flags"} || 0) & 1
$frame->{"type"}
$frame->{'flags'}
Truth table66%2/3
A and B
A= $frame->{"type"}B= $frame->{'flags'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | && (($frame->{flags} || 0) & H2_END_STREAM)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | 35 | $self->_finish_response($stream_id); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | 65 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | 49 | ▶ | sub _on_data_chunk_recv { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_on_data_chunk_recv: called CC=5 SCAR=17.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | 49 | my ($self, $stream_id, $data, $flags) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | 49 | ▶ | my $state = $self->{receive}{$stream_id} or return 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | 48 | ▶ | my $transaction = $self->transaction_for_stream_id($stream_id) or return 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | 48 | my $response = $state->{response}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 48 | ▶ | if (!$response) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | 0 | $self->_stream_failure( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | $stream_id, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 'HTTP/2 DATA arrived before final Response headers', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 48 | $transaction->_receive_body_bytes(length $data); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 48 | my $result = $transaction->_receive_data($response, $data); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | 48 | ▶ | if ($result ne '1') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | 0 | $self->_stream_failure($stream_id, "$result"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | 48 | $transaction->_auto_consume_body; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | 48 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | 39 | ▶ | sub _finish_response { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_finish_response: called CC=7 SCAR=21.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | 39 | my ($self, $stream_id) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | 39 | ▶ | my $state = $self->{receive}{$stream_id} or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | 39 | ▶ | return if $state->{response_done}++; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | 39 | ▶ | my $transaction = $self->transaction_for_stream_id($stream_id) or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | 39 | my $response = $state->{response}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 39 | ▶ | if (!$response) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | 0 | $self->_stream_failure( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | $stream_id, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | 'HTTP/2 stream ended before final Response headers', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | 39 | ▶ | return if $transaction->is_terminal; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | 39 | $transaction->_finish_receive($response); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | 39 | $response->mark_complete->freeze; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | 39 | my $result = $transaction->_invoke('on_complete'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | 39 | ▶ | $self->_invoke_stream_error($transaction, "$result") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | unless $result eq '1'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | 39 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | 50 | ▶ | sub _on_stream_close { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_on_stream_close: called CC=9 SCAR=22.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | 50 | my ($self, $stream_id, $error_code) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | 50 | my $state = delete $self->{receive}{$stream_id}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | 50 | delete $self->{providers}{$stream_id}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | 50 | ▶ | my $transaction = $self->_remove_transaction($stream_id) or return 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | 50 | ▶ | return 0 if $transaction->is_terminal; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | 48 | ▶ | if ($error_code) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | 8 | my $error = "HTTP/2 stream closed with error $error_code"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | 8 | $transaction->_fail($error, $error_code, 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | 8 | $self->_invoke_stream_error($transaction, $error, $error_code); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | ▶ | elsif ($state && $state->{response}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$state and $state->{"response"}
MC/DC50%1/2
$state and $state->{"response"}
$state
$state->{"response"}
Truth table66%2/3
A and B
A= $stateB= $state->{"response"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | 39 | ▶ | $transaction->_finish_receive($state->{response}) unless $state->{response_done}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | 39 | $state->{response}->mark_complete->freeze; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | 39 | ▶ | if (!$state->{response_done}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | 0 | my $result = $transaction->_invoke('on_complete'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | 0 | ▶ | $self->_invoke_stream_error($transaction, "$result") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | unless $result eq '1'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | 39 | $transaction->_mark_complete; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | 39 | $transaction->_notify_finish; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | 1 | my $error = 'HTTP/2 stream closed before final Response'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | 1 | $transaction->_fail($error); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | 1 | $self->_invoke_stream_error($transaction, $error); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | 48 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | 0 | ▶ | sub _stream_failure { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_stream_failure: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | 0 | my ($self, $stream_id, $error, $code) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | 0 | ▶ | $code = H2_INTERNAL_ERROR unless defined $code; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | 0 | ▶ | $error = 'HTTP/2 stream failure' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $error and length $error
MC/DC0%0/2
defined $error and length $error
defined $error
length $error
Truth table0%0/3
A and B
A= defined $errorB= length $error
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | unless defined($error) && length($error); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | 0 | ▶ | my $transaction = $self->transaction_for_stream_id($stream_id) or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | 0 | ▶ | return if $transaction->is_terminal; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | 0 | $transaction->_fail($error, $code, 0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | 0 | eval { $self->{session}->submit_rst_stream($stream_id, $code) }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | 0 | $self->_invoke_stream_error($transaction, $error, $code); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | 16 | ▶ | sub _write_stream_body { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_write_stream_body: called CC=10 SCAR=23.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | 16 | my ($self, $transaction, $bytes, $final, $operation) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | 16 | ▶ | my $provider = $self->{providers}{ $transaction->stream_id } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | or croak "$operation(): Transaction has no streaming Request body"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | 16 | $bytes = $self->_body_bytes("$operation()", $bytes); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | croak "$operation(): streaming Request body is already complete" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | 16 | ▶ | if $provider->{eof}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | 16 | $provider->{queue} .= $bytes; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | 16 | ▶ | if ($final) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | 7 | my $trailers = Unblock::HTTP2::_Headers->trailer_fields( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | "$operation()", $transaction->request, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | 7 | ▶ | $provider->{trailers} = $trailers if @$trailers; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | 7 | $provider->{eof} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | 16 | ▶ | if ($self->{session}->is_stream_deferred($transaction->stream_id)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | 5 | $self->{session}->resume_stream($transaction->stream_id); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | 16 | my $blocked = length($provider->{queue}) >= $BODY_HIGH_WATER; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | 16 | ▶ | $provider->{blocked} = 1 if $blocked; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | 16 | ▶ | $self->_transport_sync if $self->{transport_attached}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | 16 | ▶ | if ($self->{transport_blocked}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | 1 | $provider->{blocked} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | 1 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | 15 | ▶ | return $blocked ? 0 : 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | 0 | ▶ | sub _send_informational_stream { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_send_informational_stream: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | 0 | croak 'send_informational(): client-side streams cannot send Responses'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | 0 | ▶ | sub _respond_stream { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_respond_stream: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | 0 | croak 'respond(): client-side streams cannot send Responses'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | 0 | ▶ | sub _cancel_stream { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_cancel_stream: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | 0 | my ($self, $transaction) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | 0 | ▶ | return if $transaction->is_terminal; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | 0 | $self->_reset_stream($transaction, H2_CANCEL); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | 8 | ▶ | sub close { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
close: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | 8 | my ($self, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | 8 | $self->SUPER::close(@args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | 8 | $self->{receive} = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | 8 | $self->{providers} = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | 8 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | 30 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||