| 1 | package Unblock::HTTP2::_nghttp2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 30 | our $VERSION = '0.13'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 30 | require XSLoader; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 30 | XSLoader::load('Unblock::HTTP2', $VERSION); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 231 | ▶ | sub available { return _available() ? 1 : 0 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
available: called CC=2 SCAR=7.6
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 30 | ▶ | use constant { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 30 | SETTINGS_HEADER_TABLE_SIZE => 1, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | SETTINGS_ENABLE_PUSH => 2, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | SETTINGS_MAX_CONCURRENT_STREAMS => 3, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | SETTINGS_INITIAL_WINDOW_SIZE => 4, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | SETTINGS_MAX_FRAME_SIZE => 5, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | SETTINGS_MAX_HEADER_LIST_SIZE => 6, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | SETTINGS_ENABLE_CONNECT_PROTOCOL => 8, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | SETTINGS_NO_RFC7540_PRIORITIES => 9, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 30 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | package Unblock::HTTP2::_nghttp2::Session; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 30 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 30 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 30 | ▶ | use Carp qw(croak); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 231 | ▶ | sub _callbacks { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_callbacks: called CC=6 SCAR=19.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 231 | my ($callbacks) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 231 | ▶ | $callbacks ||= {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$callbacks ||= {}
MC/DC0%0/1
$callbacks ||= {}
$callbacks
Truth table50%1/2
A
A= $callbacks
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 231 | ▶ | croak 'callbacks must be a hash reference' unless ref($callbacks) eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 231 | for my $name (keys %$callbacks) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 1155 | my $cb = $callbacks->{$name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 1155 | ▶ | croak "callback $name must be a coderef" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $cb and ref $cb ne "CODE"
MC/DC0%0/2
defined $cb and ref $cb ne "CODE"
defined $cb
ref $cb ne "CODE"
Truth table33%1/3
A and B
A= defined $cbB= ref $cb ne "CODE"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | if defined($cb) && ref($cb) ne 'CODE'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 231 | return $callbacks; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 231 | ▶ | sub _max_header_list_size { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_max_header_list_size: called CC=6 SCAR=22.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 231 | my ($operation, $args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | my $limit = exists($args->{max_header_list_size}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | ? delete($args->{max_header_list_size}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 231 | ▶ | : 65_536; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 231 | ▶ | croak "$operation: max_header_list_size must be a positive integer" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
defined $limit and not ref $limit and "$limit" =~ /\A[0-9]+\z/ and $limit > 0
defined $limit and not ref $limit and "$limit" =~ /\A[0-9]+\z/
defined $limit and not ref $limit
MC/DC0%0/4
defined $limit and not ref $limit and "$limit" =~ /\A[0-9]+\z/ and $limit > 0
defined $limit
not ref $limit
"$limit" =~ /\A[0-9]+\z/
$limit > 0
Truth table20%1/5
A and not(B) and C and D
A= defined $limitB= not ref $limitC= "$limit" =~ /\A[0-9]+\z/D= $limit > 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | unless defined($limit) && !ref($limit) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | && "$limit" =~ /\A[0-9]+\z/ && $limit > 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 231 | return 0 + $limit; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 58 | ▶ | sub new_client { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new_client: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 58 | my ($class, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 58 | my $callbacks = _callbacks(delete($args{callbacks})); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 58 | my $max_header_list_size = _max_header_list_size('new_client()', \%args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 58 | ▶ | croak 'new_client(): unknown options: ' . join(', ', sort keys %args) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | if %args; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 58 | return $class->_new_client_xs($callbacks, $max_header_list_size); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 173 | ▶ | sub new_server { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new_server: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 173 | my ($class, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 173 | my $callbacks = _callbacks(delete($args{callbacks})); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 173 | my $max_header_list_size = _max_header_list_size('new_server()', \%args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 173 | ▶ | croak 'new_server(): unknown options: ' . join(', ', sort keys %args) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | if %args; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 173 | return $class->_new_server_xs($callbacks, $max_header_list_size); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | ▶ | sub send_connection_preface { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
send_connection_preface: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | my ($self, %settings) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | return $self->submit_settings(\%settings); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 7275 | ▶ | sub _body_provider { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_body_provider: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 7275 | my ($body) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 7275 | ▶ | return unless defined $body; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 7238 | ▶ | return $body if ref($body) eq 'CODE'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 7224 | ▶ | croak 'body must be a byte string or coderef' if ref($body); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 7224 | ▶ | return if !length($body); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 7222 | my $offset = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 7222 | my $length = length($body); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 7221 | ▶ | return sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 7221 | my ($stream_id, $max_length) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 7221 | my $left = $length - $offset; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 7221 | ▶ | my $take = $left < $max_length ? $left : $max_length; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 7221 | my $chunk = substr($body, $offset, $take); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 7221 | $offset += $take; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 7221 | ▶ | return ($chunk, $offset >= $length ? 1 : 0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 7222 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | ▶ | sub _submit_request_xs { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_submit_request_xs: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | my ($self, $headers, $body) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | my $provider = _body_provider($body); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | return $self->_submit_request_native($headers, $provider); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 58 | ▶ | sub _submit_request_uniform_xs { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_submit_request_uniform_xs: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 58 | my ($self, $message, $body) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 58 | my $provider = _body_provider($body); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 58 | return $self->_submit_request_uniform_native($message, $provider); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 7217 | ▶ | sub submit_response_uniform { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
submit_response_uniform: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 7217 | my ($self, $stream_id, $message, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 7217 | my $body = delete($args{body}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 7217 | my $data_callback = delete($args{data_callback}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 7217 | delete $args{callback_data}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 7217 | ▶ | croak 'submit_response_uniform(): unknown options: ' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | . join(', ', sort keys %args) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | if %args; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 7217 | ▶ | my $provider = defined($data_callback) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | ? _body_provider($data_callback) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | : _body_provider($body); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 7217 | ▶ | return $provider | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | ? $self->_submit_response_uniform_streaming_native( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | $stream_id, $message, $provider, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | : $self->_submit_response_uniform_no_body_native( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | $stream_id, $message, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 3 | ▶ | sub submit_response_headers_uniform { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
submit_response_headers_uniform: called CC=4 SCAR=14.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 3 | my ($self, $stream_id, $message, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 3 | ▶ | my $end_stream = delete($args{end_stream}) || 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
delete $args{'end_stream'} || 0
MC/DC0%0/1
delete $args{'end_stream'} || 0
delete $args{'end_stream'}
Truth table50%1/2
A
A= delete $args{'end_stream'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 3 | ▶ | croak 'submit_response_headers_uniform(): unknown options: ' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | . join(', ', sort keys %args) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | if %args; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 3 | ▶ | return $self->_submit_response_headers_uniform_native( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | $stream_id, $message, $end_stream ? 1 : 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | ▶ | sub submit_response { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
submit_response: not called CC=10 SCAR=47.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | my ($self, $stream_id, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | ▶ | my $status = exists($args{status}) ? delete($args{status}) : 200; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | ▶ | my $headers = delete($args{headers}) || []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
delete $args{'headers'} || []
MC/DC0%0/1
delete $args{'headers'} || []
delete $args{'headers'}
Truth table0%0/2
A
A= delete $args{'headers'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | my $body = delete $args{body}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | my $data_callback = delete $args{data_callback}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | delete $args{callback_data}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | ▶ | croak 'submit_response(): unknown options: ' . join(', ', sort keys %args) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | if %args; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | ▶ | croak 'submit_response(): headers must be an array reference' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | unless ref($headers) eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | ▶ | croak 'submit_response(): status must be an integer' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
defined $status and not ref $status and $status =~ /\A[0-9]+\z/
defined $status and not ref $status
MC/DC0%0/3
defined $status and not ref $status and $status =~ /\A[0-9]+\z/
defined $status
not ref $status
$status =~ /\A[0-9]+\z/
Truth table0%0/4
A and not(B) and C
A= defined $statusB= not ref $statusC= $status =~ /\A[0-9]+\z/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | unless defined($status) && !ref($status) && $status =~ /\A[0-9]+\z/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | my @block = ([ ':status', "$status" ], @$headers); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | ▶ | my $provider = defined($data_callback) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | ? _body_provider($data_callback) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | : _body_provider($body); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | ▶ | return $provider | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | ? $self->_submit_response_streaming_native($stream_id, \@block, $provider) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | : $self->_submit_response_no_body_native($stream_id, \@block); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | ▶ | sub submit_headers { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
submit_headers: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | my ($self, $stream_id, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | ▶ | my $headers = delete($args{headers}) || []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
delete $args{'headers'} || []
MC/DC0%0/1
delete $args{'headers'} || []
delete $args{'headers'}
Truth table0%0/2
A
A= delete $args{'headers'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | ▶ | my $end_stream = delete($args{end_stream}) || 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
delete $args{'end_stream'} || 0
MC/DC0%0/1
delete $args{'end_stream'} || 0
delete $args{'end_stream'}
Truth table0%0/2
A
A= delete $args{'end_stream'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | ▶ | croak 'submit_headers(): unknown options: ' . join(', ', sort keys %args) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | if %args; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | ▶ | croak 'submit_headers(): headers must be an array reference' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | unless ref($headers) eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | ▶ | return $self->_submit_headers_native($stream_id, $headers, $end_stream ? 1 : 0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 5 | ▶ | sub submit_trailer { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
submit_trailer: called CC=4 SCAR=14.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 5 | my ($self, $stream_id, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 5 | ▶ | my $headers = delete($args{headers}) || []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
delete $args{'headers'} || []
MC/DC0%0/1
delete $args{'headers'} || []
delete $args{'headers'}
Truth table50%1/2
A
A= delete $args{'headers'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 5 | ▶ | croak 'submit_trailer(): unknown options: ' . join(', ', sort keys %args) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | if %args; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 5 | ▶ | croak 'submit_trailer(): headers must be an array reference' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | unless ref($headers) eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 5 | return $self->_submit_trailer_native($stream_id, $headers); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 1 | ▶ | sub submit_priority_update { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
submit_priority_update: called CC=8 SCAR=25.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 1 | my ($self, $stream_id, $field_value) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 1 | ▶ | croak 'submit_priority_update(): stream id must be a positive integer' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
defined $stream_id and not ref $stream_id and "$stream_id" =~ /\A[0-9]+\z/ and $stream_id > 0
defined $stream_id and not ref $stream_id and "$stream_id" =~ /\A[0-9]+\z/
defined $stream_id and not ref $stream_id
MC/DC0%0/4
defined $stream_id and not ref $stream_id and "$stream_id" =~ /\A[0-9]+\z/ and $stream_id > 0
defined $stream_id
not ref $stream_id
"$stream_id" =~ /\A[0-9]+\z/
$stream_id > 0
Truth table20%1/5
A and not(B) and C and D
A= defined $stream_idB= not ref $stream_idC= "$stream_id" =~ /\A[0-9]+\z/D= $stream_id > 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | unless defined($stream_id) && !ref($stream_id) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | && "$stream_id" =~ /\A[0-9]+\z/ && $stream_id > 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 1 | ▶ | croak 'submit_priority_update(): field value must be a scalar' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | if ref($field_value); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 1 | ▶ | $field_value = '' unless defined $field_value; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 1 | ▶ | croak 'submit_priority_update(): field value exceeds 16380 bytes' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | if length($field_value) > 16_380; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 1 | return $self->_submit_priority_update_native($stream_id, $field_value); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 6 | ▶ | sub submit_ping { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
submit_ping: called CC=4 SCAR=17.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 6 | my ($self, $opaque) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 6 | ▶ | croak 'submit_ping(): opaque data must be exactly 8 bytes' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
defined $opaque and not ref $opaque and length $opaque == 8
defined $opaque and not ref $opaque
MC/DC0%0/3
defined $opaque and not ref $opaque and length $opaque == 8
defined $opaque
not ref $opaque
length $opaque == 8
Truth table25%1/4
A and not(B) and C
A= defined $opaqueB= not ref $opaqueC= length $opaque == 8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | unless defined($opaque) && !ref($opaque) && length($opaque) == 8; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 6 | return $self->_submit_ping_native($opaque); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 6 | ▶ | sub submit_goaway { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
submit_goaway: called CC=5 SCAR=17.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 6 | my ($self, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 6 | my $last_stream_id = delete $args{last_stream_id}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 6 | ▶ | croak 'submit_goaway(): last_stream_id is required' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | unless defined $last_stream_id; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 6 | ▶ | my $error_code = exists($args{error_code}) ? delete($args{error_code}) : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | my $debug_data = exists($args{debug_data}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | ? delete($args{debug_data}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 6 | ▶ | : delete($args{opaque_data}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 6 | ▶ | croak 'submit_goaway(): unknown options: ' . join(', ', sort keys %args) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | if %args; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 6 | return $self->_submit_goaway_native($last_stream_id, $error_code, $debug_data); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 5 | ▶ | sub resume_stream { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
resume_stream: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 5 | my ($self, $stream_id) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 5 | $self->_clear_deferred($stream_id); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 5 | return $self->resume_data($stream_id); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 30 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||