blib/lib/Unblock/HTTP2/Client.pm

filter: Statementstmt 87.5% 267 / 305 Branchbran 68.5% 155 / 226 Conditioncond 54.9% 61 / 111 MC/DCmcdc 24.1% 15 / 62 Subroutinesub 88.5% 31 / 35 Podpod 0.0% 0 / 7 totaltotal 70.9% 529 / 746 CC 158 SCAR 34.0
CC
158
Cov
75%
request
61.3
_on_frame_recv
50.2
_stream_failure
42.0
CRAP 30.0
↑ Summary blib/lib/Unblock/HTTP2/_Headers.pm »
1 package Unblock::HTTP2::Client;
2  
3 29 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 29 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 29 ▶use Carp qw(croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
6 29 ▶use Scalar::Util qw(weaken);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 29 ▶use parent 'Unblock::HTTP2::_Connection';
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 29 ▶use Unblock::HTTP2::_Headers;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 29 ▶use Unblock::HTTP2::Transaction;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 29 ▶use Uniform::HTTP::Request;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 29 our $VERSION = '0.12';
14  
15 29 ▶use constant {
Subroutine BEGIN: called CC=1 SCAR=0.0
16 29 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 29 };
25  
26 29 my $BODY_HIGH_WATER = 65_536;
27 29 my $BODY_LOW_WATER = 32_768;
28  
29 50 ▶sub new {
Subroutine new: called CC=21 SCAR=34.7
Pod undocumented
30 50 my ($class, %option) = @_;
31 50 my $transport = delete $option{transport};
32 50 my %receive = $class->_receive_options(\%option);
33  
34 50 my %callbacks;
35 50 for my $name (qw(
36 on_settings on_settings_ack on_ping on_ping_ack on_invalid_frame
37 )) {
38 250 ▶ next unless exists $option{$name};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $option{$name} 243 7 250
39 7 my $callback = delete $option{$name};
40 7 ▶ croak "new(): $name must be a coderef"
Branch: 1 branch
BranchTrueFalseTotal
if defined $callback and ref $callback ne "CODE" 0 7 7
Condition33%1/3
defined $callback and ref $callback ne "CODE"
!ll&&!rl&&r
070
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"
ABresult
0X0
100
111
41 if defined($callback) && ref($callback) ne 'CODE';
42 7 ▶ $callbacks{$name} = $callback if $callback;
Branch: 1 branch
BranchTrueFalseTotal
if $callback 7 0 7
43 }
44  
45 my $settings = exists($option{settings})
46 ? delete($option{settings})
47 50 ▶ : {};
Branch: 1 branch
BranchTrueFalseTotal
exists $option{'settings'} ? : 1 49 50
48 50 ▶ croak 'new(): settings must be a hash reference'
Branch: 1 branch
BranchTrueFalseTotal
unless ref $settings eq "HASH" 0 50 50
49 unless ref($settings) eq 'HASH';
50  
51 my $max_active_transactions = exists($option{max_active_transactions})
52 ? delete($option{max_active_transactions})
53 50 ▶ : 100;
Branch: 1 branch
BranchTrueFalseTotal
exists $option{'max_active_transactions'} ? : 1 49 50
54 my $max_header_list_size = exists($option{max_header_list_size})
55 ? delete($option{max_header_list_size})
56 50 ▶ : 65_536;
Branch: 1 branch
BranchTrueFalseTotal
exists $option{'max_header_list_size'} ? : 0 50 50
57  
58 50 ▶ croak 'new(): max_active_transactions must be a positive integer'
Branch: 1 branch
BranchTrueFalseTotal
unless defined $max_active_transactions and not ref $max_active_transactions and $max_active_transactions =~ /\A[0-9]+\z/ and $max_active_transactions > 0 0 50 50
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
!ll&&!rl&&r
0050
defined $max_active_transactions and not ref $max_active_transactions and $max_active_transactions =~ /\A[0-9]+\z/
!ll&&!rl&&r
0050
defined $max_active_transactions and not ref $max_active_transactions
!ll&&!rl&&r
0050
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
ABCDresult
0XXX0
10XX0
110X0
11100
11111
59 unless defined($max_active_transactions) && !ref($max_active_transactions)
60 && $max_active_transactions =~ /\A[0-9]+\z/
61 && $max_active_transactions > 0;
62 50 ▶ croak 'new(): max_header_list_size must be a positive integer'
Branch: 1 branch
BranchTrueFalseTotal
unless 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 0 50 50
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
!ll&&!rl&&r
0050
defined $max_header_list_size and not ref $max_header_list_size and $max_header_list_size =~ /\A[0-9]+\z/
!ll&&!rl&&r
0050
defined $max_header_list_size and not ref $max_header_list_size
!ll&&!rl&&r
0050
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
ABCDresult
0XXX0
10XX0
110X0
11100
11111
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 50 ▶ croak 'new(): unknown options: ' . join(', ', sort keys %option)
Branch: 1 branch
BranchTrueFalseTotal
if %option 0 50 50
67 if %option;
68  
69 50 require Unblock::HTTP2::_nghttp2;
70 50 ▶ croak 'new(): nghttp2 library is unavailable'
Branch: 1 branch
BranchTrueFalseTotal
unless "Unblock::HTTP2::_nghttp2"->available 0 50 50
71 unless Unblock::HTTP2::_nghttp2->available;
72  
73 50 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 50 my $weak = $self;
83 50 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 37 ▶ on_begin_headers => sub {
Subroutine __ANON__: called CC=2 SCAR=7.2
89 37 ▶ my $self = $weak or return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $self = $weak or return 0 37 0 37
90 37 return $self->_on_begin_headers(@_);
91 },
92 186 ▶ on_frame_recv => sub {
Subroutine __ANON__: called CC=2 SCAR=7.2
93 186 ▶ my $self = $weak or return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $self = $weak or return 0 186 0 186
94 186 return $self->_on_frame_recv(@_);
95 },
96 41 ▶ on_data_chunk_recv => sub {
Subroutine __ANON__: called CC=2 SCAR=7.2
97 41 ▶ my $self = $weak or return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $self = $weak or return 0 41 0 41
98 41 return $self->_on_data_chunk_recv(@_);
99 },
100 42 ▶ on_stream_close => sub {
Subroutine __ANON__: called CC=2 SCAR=7.2
101 42 ▶ my $self = $weak or return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $self = $weak or return 0 42 0 42
102 42 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
BranchTrueFalseTotal
my $self = $weak or return 0 1 0 1
106 1 return $self->_on_invalid_frame(@_);
107 },
108 },
109 50 );
110  
111 50 $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 50 enable_push => 0,
123 no_rfc7540_priorities => 1,
124 %$settings,
125 );
126 50 $self->_submit_settings('new()', \%initial_settings);
127 50 ▶ $self->_transport_sync if $self->{transport_attached};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"transport_attached"} 10 40 50
128  
129 50 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
BranchTrueFalseTotal
$_[0]{'draining'} ? : 2 0 2
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
BranchTrueFalseTotal
unless $self->{"peer_goaway"} 0 3 3
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
BranchTrueFalseTotal
if $self->is_closed or $self->{"draining"} 0 1 1
Condition33%1/3
$self->is_closed or $self->{"draining"}
l!l&&r!l&&!r
001
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"}
ABresult
1X1
011
000
145 1 return $self->goaway(error_code => 0);
146 }
147  
148 59 ▶sub can_open_transaction {
Subroutine can_open_transaction: called CC=5 SCAR=16.1
Pod undocumented
149 59 my ($self) = @_;
150 59 ▶ return 0 if $self->is_closed || $self->{draining};
Branch: 1 branch
BranchTrueFalseTotal
if $self->is_closed or $self->{"draining"} 3 56 59
Condition66%2/3
$self->is_closed or $self->{"draining"}
l!l&&r!l&&!r
0356
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"}
ABresult
1X1
011
000
151  
152 56 my $limit = $self->{max_active_transactions};
153 56 my $peer_limit = $self->peer_setting('max_concurrent_streams');
154 56 ▶ $limit = $peer_limit if $peer_limit < $limit;
Branch: 1 branch
BranchTrueFalseTotal
if $peer_limit < $limit 5 51 56
155  
156 56 ▶ return $self->transaction_count < $limit ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$self->transaction_count < $limit ? : 54 2 56
157 }
158  
159 53 ▶sub request {
Subroutine request: called CC=43 SCAR=41.2
Pod undocumented
160 53 my ($self, @arg) = @_;
161  
162 53 my ($request, %option);
163 53 ▶ if (@arg && ref($arg[0])) {
Branch: 1 branch
BranchTrueFalseTotal
if (@arg and ref $arg[0]) { } 36 17 53
Condition66%2/3
@arg and ref $arg[0]
!ll&&!rl&&r
01736
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]
ABresult
0X0
100
111
164 36 $request = shift @arg;
165 36 ▶ croak 'request(): options must be key/value pairs' if @arg % 2;
Branch: 1 branch
BranchTrueFalseTotal
if @arg % 2 0 36 36
166 36 %option = @arg;
167 }
168 else {
169 17 ▶ croak 'request(): fields must be key/value pairs' if @arg % 2;
Branch: 1 branch
BranchTrueFalseTotal
if @arg % 2 0 17 17
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
BranchTrueFalseTotal
if exists $field{$name} 36 117 153
176 }
177 17 $request = Uniform::HTTP::Request->new(%field);
178 }
179  
180 53 ▶ croak 'request(): connection is closed' if $self->is_closed;
Branch: 1 branch
BranchTrueFalseTotal
if $self->is_closed 0 53 53
181 53 ▶ croak 'request(): connection cannot accept another transaction'
Branch: 1 branch
BranchTrueFalseTotal
unless $self->can_open_transaction 2 51 53
182 unless $self->can_open_transaction;
183 51 my $native_message = Unblock::HTTP2::_Headers->native_message($request);
184 51 ▶ croak 'request(): requires the Uniform HTTP request contract'
Branch: 1 branch
BranchTrueFalseTotal
unless $native_message or Unblock::HTTP2::_Headers::_request_contract($request) 0 51 51
Condition33%1/3
$native_message or Unblock::HTTP2::_Headers::_request_contract($request)
l!l&&r!l&&!r
5100
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)
ABresult
1X1
011
000
185 unless $native_message
186 || Unblock::HTTP2::_Headers::_request_contract($request);
187  
188 51 ▶ if (defined($request->protocol) && length($request->protocol)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $request->protocol and length $request->protocol) 2 49 51
Condition66%2/3
defined $request->protocol and length $request->protocol
!ll&&!rl&&r
4902
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
ABresult
0X0
100
111
189 2 my $enabled = $self->peer_setting('enable_connect_protocol');
190 2 ▶ croak 'request(): peer has not enabled Extended CONNECT'
Branch: 1 branch
BranchTrueFalseTotal
unless $enabled == 1 1 1 2
191 unless $enabled == 1;
192 }
193  
194 my $stream_body = exists($option{stream_body})
195 ? delete($option{stream_body})
196 50 ▶ : 0;
Branch: 1 branch
BranchTrueFalseTotal
exists $option{'stream_body'} ? : 10 40 50
197 50 ▶ croak 'request(): stream_body must be zero or one'
Branch: 1 branch
BranchTrueFalseTotal
if not defined $stream_body or ref $stream_body or not "$stream_body" =~ /\A[01]\z/ 0 50 50
Condition33%2/6
not defined $stream_body or ref $stream_body or not "$stream_body" =~ /\A[01]\z/
l!l&&r!l&&!r
0050
not defined $stream_body or ref $stream_body
l!l&&r!l&&!r
0050
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/
ABCresult
1XX1
01X1
0011
0000
198 if !defined($stream_body) || ref($stream_body)
199 || "$stream_body" !~ /\A[01]\z/;
200 50 ▶ $stream_body = $stream_body ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$stream_body ? : 10 40 50
201  
202 50 my %callbacks;
203 50 for my $name (qw(
204 on_response on_body on_data on_finish on_complete on_error on_informational on_drain
205 )) {
206 400 ▶ next unless exists $option{$name};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $option{$name} 301 99 400
207 99 my $callback = delete $option{$name};
208 99 ▶ croak "request(): $name must be a coderef"
Branch: 1 branch
BranchTrueFalseTotal
if defined $callback and ref $callback ne "CODE" 0 99 99
Condition33%1/3
defined $callback and ref $callback ne "CODE"
!ll&&!rl&&r
0990
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"
ABresult
0X0
100
111
209 if defined($callback) && ref($callback) ne 'CODE';
210 99 ▶ $callbacks{$name} = $callback if $callback;
Branch: 1 branch
BranchTrueFalseTotal
if $callback 99 0 99
211 }
212  
213 croak 'request(): on_data cannot be combined with on_body'
214 50 ▶ if $callbacks{on_data} && $callbacks{on_body};
Branch: 1 branch
BranchTrueFalseTotal
if $callbacks{"on_data"} and $callbacks{"on_body"} 0 50 50
Condition33%1/3
$callbacks{"on_data"} and $callbacks{"on_body"}
!ll&&!rl&&r
5000
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"}
ABresult
0X0
100
111
215 croak 'request(): buffered reception cannot be combined with on_body'
216 50 ▶ if $self->{receive_body} eq 'buffered' && $callbacks{on_body};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"receive_body"} eq "buffered" and $callbacks{"on_body"} 0 50 50
Condition66%2/3
$self->{"receive_body"} eq "buffered" and $callbacks{"on_body"}
!ll&&!rl&&r
40100
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"}
ABresult
0X0
100
111
217 50 ▶ croak 'request(): unknown options: ' . join(', ', sort keys %option)
Branch: 1 branch
BranchTrueFalseTotal
if %option 0 50 50
218 if %option;
219 croak 'request(): on_drain requires stream_body'
220 50 ▶ if $callbacks{on_drain} && !$stream_body;
Branch: 1 branch
BranchTrueFalseTotal
if $callbacks{"on_drain"} and not $stream_body 0 50 50
Condition66%2/3
$callbacks{"on_drain"} and not $stream_body
!ll&&!rl&&r
4820
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
ABresult
0X0
100
111
221 50 ▶ croak 'request(): stream_body cannot be combined with a buffered body'
Branch: 1 branch
BranchTrueFalseTotal
if $stream_body and $request->has_buffered_body 0 50 50
Condition66%2/3
$stream_body and $request->has_buffered_body
!ll&&!rl&&r
40100
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
ABresult
0X0
100
111
222 if $stream_body && $request->has_buffered_body;
223  
224 50 ▶ my $block = $native_message
Branch: 1 branch
BranchTrueFalseTotal
$native_message ? : 50 0 50
225 ? undef
226 : Unblock::HTTP2::_Headers->request_headers($request);
227 50 my $trailers = Unblock::HTTP2::_Headers->trailer_fields(
228 'request()', $request,
229 );
230  
231 50 my ($provider, $body);
232 50 ▶ if ($stream_body || @$trailers) {
Branch: 2 branches
BranchTrueFalseTotal
if ($stream_body or @$trailers) { } 11 39 50
elsif ($request->has_buffered_body) { } 12 27 39
Condition100%3/3
$stream_body or @$trailers
l!l&&r!l&&!r
10139
MC/DC100%2/2
$stream_body or @$trailers
$stream_body @$trailers
Truth table100%3/3
A or B
A= $stream_bodyB= @$trailers
ABresult
1X1
011
000
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
BranchTrueFalseTotal
unless ($stream_body) 1 10 11
243 1 ▶ $provider->{queue} = $request->has_buffered_body
Branch: 1 branch
BranchTrueFalseTotal
$request->has_buffered_body ? : 1 0 1
244 ? $request->body
245 : '';
246 1 $provider->{eof} = 1;
247 1 ▶ $provider->{trailers} = $trailers if @$trailers;
Branch: 1 branch
BranchTrueFalseTotal
if @$trailers 1 0 1
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
BranchTrueFalseTotal
my $self = $weak_self or return "", 1 31 0 31
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 50 ▶ : $self->{session}->_submit_request_xs($block, $body);
Branch: 1 branch
BranchTrueFalseTotal
$native_message ? : 50 0 50
265  
266 50 my $transaction = Unblock::HTTP2::Transaction->_new(
267 connection => $self,
268 stream_id => $stream_id,
269 request => $request,
270 callbacks => \%callbacks,
271 );
272  
273 50 $self->_register_transaction($transaction);
274 50 $self->{receive}{$stream_id} = {
275 response => undef,
276 response_done => 0,
277 };
278  
279 50 ▶ if ($provider) {
Branch: 1 branch
BranchTrueFalseTotal
if ($provider) 11 39 50
280 11 $provider->{stream_id} = $stream_id;
281 11 $self->{providers}{$stream_id} = $provider;
282 }
283  
284 50 ▶ $self->_transport_sync if $self->{transport_attached};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"transport_attached"} 4 46 50
285 50 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
BranchTrueFalseTotal
unless (length $provider->{"queue"}) 9 22 31
291 9 ▶ if ($provider->{eof}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($provider->{"eof"}) 1 8 9
292 1 ▶ if ($provider->{trailers}
Branch: 1 branch
BranchTrueFalseTotal
if ($provider->{"trailers"} and not $provider->{"trailer_submitted"}) 0 1 1
Condition33%1/3
$provider->{"trailers"} and not $provider->{"trailer_submitted"}
!ll&&!rl&&r
100
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"}
ABresult
0X0
100
111
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
BranchTrueFalseTotal
length $provider->{'queue'} < $max_length ? : 10 12 22
305 22 my $chunk = substr($provider->{queue}, 0, $take, '');
306 22 ▶ my $eof = $provider->{eof} && !length($provider->{queue}) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$provider->{'eof'} && !length($provider->{'queue'}) ? : 7 15 22
Condition100%3/3
$provider->{"eof"} and not length $provider->{"queue"}
!ll&&!rl&&r
877
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"}
ABresult
0X0
100
111
307 22 my $no_end_stream = 0;
308  
309 22 ▶ if ($eof && $provider->{trailers}
Branch: 1 branch
BranchTrueFalseTotal
if ($eof and $provider->{"trailers"} and not $provider->{"trailer_submitted"}) 3 19 22
Condition83%5/6
$eof and $provider->{"trailers"} and not $provider->{"trailer_submitted"}
!ll&&!rl&&r
1903
$eof and $provider->{"trailers"}
!ll&&!rl&&r
1543
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"}
ABCresult
0XX0
10X0
1100
1111
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
BranchTrueFalseTotal
if ($provider->{"blocked"} and length $provider->{"queue"} < $BODY_LOW_WATER) 2 20 22
Condition100%3/3
$provider->{"blocked"} and length $provider->{"queue"} < $BODY_LOW_WATER
!ll&&!rl&&r
1822
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
ABresult
0X0
100
111
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
BranchTrueFalseTotal
$no_end_stream ? : 3 19 22
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
BranchTrueFalseTotal
if $provider->{"trailer_submitted"} 0 3 3
329  
330 $self->{session}->submit_trailer(
331 $provider->{stream_id},
332 3 ▶ headers => $provider->{trailers} || [],
Condition50%1/2
$provider->{'trailers'} || []
l!l
30
MC/DC0%0/1
$provider->{'trailers'} || []
$provider->{'trailers'}
Truth table50%1/2
A
A= $provider->{'trailers'}
Aresult
11
00
333 );
334 3 $provider->{trailer_submitted} = 1;
335 3 return;
336 }
337 37 ▶sub _on_begin_headers {
Subroutine _on_begin_headers: called CC=1 SCAR=0.0
338 37 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
BranchTrueFalseTotal
ref $frame eq 'HASH' ? : 1 0 1
345 1 ▶ $self->_invoke_control_callback(
Condition50%1/2
$lib_error_code || 0
l!l
10
MC/DC0%0/1
$lib_error_code || 0
$lib_error_code
Truth table50%1/2
A
A= $lib_error_code
Aresult
11
00
346 'on_invalid_frame',
347 $copy,
348 0 + ($lib_error_code || 0),
349 );
350 1 return 0;
351 }
352  
353 186 ▶sub _on_frame_recv {
Subroutine _on_frame_recv: called CC=32 SCAR=39.2
354 186 my ($self, $frame) = @_;
355  
356 186 ▶ return 0 if $self->_handle_settings_frame($frame);
Branch: 1 branch
BranchTrueFalseTotal
if $self->_handle_settings_frame($frame) 83 103 186
357 103 ▶ return 0 if $self->_handle_ping_frame($frame);
Branch: 1 branch
BranchTrueFalseTotal
if $self->_handle_ping_frame($frame) 3 100 103
358  
359 100 ▶ if (($frame->{type} // -1) == H2_GOAWAY) {
Branch: 1 branch
BranchTrueFalseTotal
if (($frame->{"type"} // -1) == 7) 3 97 100
Condition50%1/2
$frame->{"type"} // -1
l!l
1000
MC/DC0%0/1
$frame->{"type"} // -1
$frame->{"type"}
Truth table50%1/2
A
A= $frame->{"type"}
Aresult
11
00
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
BranchTrueFalseTotal
defined $frame->{'debug_data'} ? : 3 0 3
Condition50%2/4
$frame->{"last_stream_id"} // 0
l!l
30
$frame->{"error_code"} // 0
l!l
30
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"}
Aresult
11
00
Truth table50%1/2
A
A= $frame->{"error_code"}
Aresult
11
00
366 : '',
367 };
368 3 return 0;
369 }
370  
371 97 ▶ my $stream_id = $frame->{stream_id} || 0;
Condition100%2/2
$frame->{'stream_id'} || 0
l!l
952
MC/DC100%1/1
$frame->{'stream_id'} || 0
$frame->{'stream_id'}
Truth table100%2/2
A
A= $frame->{'stream_id'}
Aresult
11
00
372 97 ▶ return 0 unless $stream_id;
Branch: 1 branch
BranchTrueFalseTotal
unless $stream_id 2 95 97
373  
374 95 ▶ my $state = $self->{receive}{$stream_id} or return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $state = $self->{"receive"}{$stream_id} or return 0 94 1 95
375 94 ▶ my $transaction = $self->transaction_for_stream_id($stream_id) or return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $transaction = $self->transaction_for_stream_id($stream_id) or return 0 94 0 94
376  
377 94 ▶ if (($frame->{type} // -1) == H2_HEADERS) {
Branch: 1 branch
BranchTrueFalseTotal
if (($frame->{"type"} // -1) == 1) 37 57 94
Condition50%1/2
$frame->{"type"} // -1
l!l
940
MC/DC0%0/1
$frame->{"type"} // -1
$frame->{"type"}
Truth table50%1/2
A
A= $frame->{"type"}
Aresult
11
00
378 37 ▶ if (defined $frame->{header_error}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $frame->{"header_error"}) 0 37 37
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 37 ▶ if (!$state->{response}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($state->{"response"}) 35 2 37
388 35 my $response = $frame->{uniform_message};
389 35 ▶ if (!$response) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($response) 0 35 35
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 35 my $status = $response->status;
398 35 ▶ if ($status >= 100 && $status < 200) {
Branch: 1 branch
BranchTrueFalseTotal
if ($status >= 100 and $status < 200) 3 32 35
Condition66%2/3
$status >= 100 and $status < 200
!ll&&!rl&&r
0323
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
ABresult
0X0
100
111
399 3 my $result = $transaction->_invoke(
400 'on_informational', $response,
401 );
402 3 ▶ $self->_stream_failure($stream_id, "$result")
Branch: 1 branch
BranchTrueFalseTotal
unless $result eq 1 0 3 3
403 unless $result eq '1';
404 3 return 0;
405 }
406  
407 32 $state->{response} = $response;
408 32 $transaction->_set_response($response);
409  
410 32 my $result = $transaction->_invoke('on_response', $response);
411 32 ▶ if ($result ne '1') {
Branch: 1 branch
BranchTrueFalseTotal
if ($result ne 1) 0 32 32
412 0 $self->_stream_failure($stream_id, "$result");
413 0 return 0;
414 }
415  
416 32 ▶ if (($frame->{flags} || 0) & H2_END_STREAM) {
Branch: 1 branch
BranchTrueFalseTotal
if (($frame->{"flags"} || 0) & 1) 2 30 32
Condition50%1/2
$frame->{'flags'} || 0
l!l
320
MC/DC0%0/1
$frame->{'flags'} || 0
$frame->{'flags'}
Truth table50%1/2
A
A= $frame->{'flags'}
Aresult
11
00
417 2 $self->_finish_response($stream_id);
418 }
419  
420 32 return 0;
421 }
422  
423 2 ▶ if ($frame->{uniform_message}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($frame->{"uniform_message"}) 0 2 2
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
BranchTrueFalseTotal
unless (($frame->{"flags"} || 0) & 1) 0 2 2
Condition50%1/2
$frame->{'flags'} || 0
l!l
20
MC/DC0%0/1
$frame->{'flags'} || 0
$frame->{'flags'}
Truth table50%1/2
A
A= $frame->{'flags'}
Aresult
11
00
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'} || []
l!l
20
MC/DC0%0/1
$frame->{'native_headers'} || []
$frame->{'native_headers'}
Truth table50%1/2
A
A= $frame->{'native_headers'}
Aresult
11
00
444 );
445 2 1;
446 };
447 2 ▶ if (!$ok) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($ok) 0 2 2
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 57 ▶ if (($frame->{type} // -1) == H2_DATA
Branch: 1 branch
BranchTrueFalseTotal
if (($frame->{"type"} // -1) == 0 and ($frame->{"flags"} || 0) & 1) 27 30 57
Condition85%6/7
($frame->{"type"} // -1) == 0 and ($frame->{"flags"} || 0) & 1
!ll&&!rl&&r
171327
$frame->{"type"} // -1
l!l
570
$frame->{'flags'} || 0
l!l
2713
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'}
ABresult
0X0
100
111
457 && (($frame->{flags} || 0) & H2_END_STREAM)) {
458 27 $self->_finish_response($stream_id);
459 }
460  
461 57 return 0;
462 }
463  
464 41 ▶sub _on_data_chunk_recv {
Subroutine _on_data_chunk_recv: called CC=5 SCAR=17.6
465 41 my ($self, $stream_id, $data, $flags) = @_;
466 41 ▶ my $state = $self->{receive}{$stream_id} or return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $state = $self->{"receive"}{$stream_id} or return 0 40 1 41
467 40 ▶ my $transaction = $self->transaction_for_stream_id($stream_id) or return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $transaction = $self->transaction_for_stream_id($stream_id) or return 0 40 0 40
468 40 my $response = $state->{response};
469  
470 40 ▶ if (!$response) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($response) 0 40 40
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 40 $transaction->_receive_body_bytes(length $data);
479  
480 40 my $result = $transaction->_receive_data($response, $data);
481 40 ▶ if ($result ne '1') {
Branch: 1 branch
BranchTrueFalseTotal
if ($result ne 1) 0 40 40
482 0 $self->_stream_failure($stream_id, "$result");
483 0 return 0;
484 }
485  
486 40 $transaction->_auto_consume_body;
487 40 return 0;
488 }
489  
490 31 ▶sub _finish_response {
Subroutine _finish_response: called CC=7 SCAR=21.3
491 31 my ($self, $stream_id) = @_;
492 31 ▶ my $state = $self->{receive}{$stream_id} or return;
Branch: 1 branch
BranchTrueFalseTotal
my $state = $self->{"receive"}{$stream_id} or return 31 0 31
493 31 ▶ return if $state->{response_done}++;
Branch: 1 branch
BranchTrueFalseTotal
if $state->{"response_done"}++ 0 31 31
494  
495 31 ▶ my $transaction = $self->transaction_for_stream_id($stream_id) or return;
Branch: 1 branch
BranchTrueFalseTotal
my $transaction = $self->transaction_for_stream_id($stream_id) or return 31 0 31
496 31 my $response = $state->{response};
497  
498 31 ▶ if (!$response) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($response) 0 31 31
499 0 $self->_stream_failure(
500 $stream_id,
501 'HTTP/2 stream ended before final Response headers',
502 );
503 0 return;
504 }
505  
506 31 ▶ return if $transaction->is_terminal;
Branch: 1 branch
BranchTrueFalseTotal
if $transaction->is_terminal 0 31 31
507 31 $transaction->_finish_receive($response);
508 31 $response->mark_complete->freeze;
509  
510 31 my $result = $transaction->_invoke('on_complete');
511 31 ▶ $self->_invoke_stream_error($transaction, "$result")
Branch: 1 branch
BranchTrueFalseTotal
unless $result eq 1 0 31 31
512 unless $result eq '1';
513 31 return;
514 }
515 42 ▶sub _on_stream_close {
Subroutine _on_stream_close: called CC=9 SCAR=22.8
516 42 my ($self, $stream_id, $error_code) = @_;
517 42 my $state = delete $self->{receive}{$stream_id};
518 42 delete $self->{providers}{$stream_id};
519  
520 42 ▶ my $transaction = $self->_remove_transaction($stream_id) or return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $transaction = $self->_remove_transaction($stream_id) or return 0 42 0 42
521 42 ▶ return 0 if $transaction->is_terminal;
Branch: 1 branch
BranchTrueFalseTotal
if $transaction->is_terminal 2 40 42
522  
523 40 ▶ if ($error_code) {
Branch: 2 branches
BranchTrueFalseTotal
if ($error_code) { } 8 32 40
elsif ($state and $state->{'response'}) { } 31 1 32
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"}
!ll&&!rl&&r
1031
MC/DC50%1/2
$state and $state->{"response"}
$state $state->{"response"}
Truth table66%2/3
A and B
A= $stateB= $state->{"response"}
ABresult
0X0
100
111
529 31 ▶ $transaction->_finish_receive($state->{response}) unless $state->{response_done};
Branch: 1 branch
BranchTrueFalseTotal
unless $state->{"response_done"} 0 31 31
530 31 $state->{response}->mark_complete->freeze;
531 31 ▶ if (!$state->{response_done}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($state->{"response_done"}) 0 31 31
532 0 my $result = $transaction->_invoke('on_complete');
533 0 ▶ $self->_invoke_stream_error($transaction, "$result")
Branch: 1 branch
BranchTrueFalseTotal
unless $result eq 1 0 0 0
534 unless $result eq '1';
535 }
536 31 $transaction->_mark_complete;
537 31 $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 40 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
BranchTrueFalseTotal
unless defined $code 0 0 0
550 0 ▶ $error = 'HTTP/2 stream failure'
Branch: 1 branch
BranchTrueFalseTotal
unless defined $error and length $error 0 0 0
Condition0%0/3
defined $error and length $error
!ll&&!rl&&r
000
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
ABresult
0X0
100
111
551 unless defined($error) && length($error);
552  
553 0 ▶ my $transaction = $self->transaction_for_stream_id($stream_id) or return;
Branch: 1 branch
BranchTrueFalseTotal
my $transaction = $self->transaction_for_stream_id($stream_id) or return 0 0 0
554 0 ▶ return if $transaction->is_terminal;
Branch: 1 branch
BranchTrueFalseTotal
if $transaction->is_terminal 0 0 0
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
BranchTrueFalseTotal
my $provider = $self->{"providers"}{$transaction->stream_id} or croak("$operation(): Transaction has no streaming Request body") 16 0 16
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
BranchTrueFalseTotal
if $provider->{"eof"} 0 16 16
571  
572 16 $provider->{queue} .= $bytes;
573  
574 16 ▶ if ($final) {
Branch: 1 branch
BranchTrueFalseTotal
if ($final) 7 9 16
575 7 my $trailers = Unblock::HTTP2::_Headers->trailer_fields(
576 "$operation()", $transaction->request,
577 );
578 7 ▶ $provider->{trailers} = $trailers if @$trailers;
Branch: 1 branch
BranchTrueFalseTotal
if @$trailers 2 5 7
579 7 $provider->{eof} = 1;
580 }
581  
582 16 ▶ if ($self->{session}->is_stream_deferred($transaction->stream_id)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"session"}->is_stream_deferred($transaction->stream_id)) 5 11 16
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
BranchTrueFalseTotal
if $blocked 1 15 16
588 16 ▶ $self->_transport_sync if $self->{transport_attached};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"transport_attached"} 1 15 16
589 16 ▶ if ($self->{transport_blocked}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"transport_blocked"}) 1 15 16
590 1 $provider->{blocked} = 1;
591 1 return 0;
592 }
593 15 ▶ return $blocked ? 0 : 1;
Branch: 1 branch
BranchTrueFalseTotal
$blocked ? : 1 14 15
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
BranchTrueFalseTotal
if $transaction->is_terminal 0 0 0
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 29 1;
619  
620 __END__
↑ Summary blib/lib/Unblock/HTTP2/_Headers.pm »