| 1 | package Linux::Event::HTTP::Client; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 14 | ▶ | use v5.36; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 14 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 14 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 14 | ▶ | use Carp qw(croak); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 14 | ▶ | use Scalar::Util qw(blessed refaddr weaken); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 14 | ▶ | use URI (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 14 | ▶ | use HTTP::CookieJar 0.014 (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 14 | ▶ | use Linux::Event::HTTP::Client::Connection; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 14 | ▶ | use Linux::Event::HTTP::Client::Operation; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 14 | ▶ | use Linux::Event::HTTP::Request; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 14 | ▶ | use Linux::Event::HTTP::_ClientAuth (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 14 | our $VERSION = '0.003'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 14 | my %CALLBACK = map { $_ => 1 } qw( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | on_response on_body on_complete on_error on_informational on_redirect | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | on_upgrade on_tunnel | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 14 | my %REDIRECT_STATUS = map { $_ => 1 } qw(301 302 303 307 308); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 20 | ▶ | sub _load_connection_class ($class) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_load_connection_class: called CC=6 SCAR=23.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 20 | ▶ | croak 'new(): connection_class must be a package name' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
not defined $class or ref $class or not $class =~ /\A[A-Za-z_][A-Za-z0-9_]*(?:::[A-Za-z_][A-Za-z0-9_]*)*\z/u
not defined $class or ref $class
MC/DC0%0/3
not defined $class or ref $class or not $class =~ /\A[A-Za-z_][A-Za-z0-9_]*(?:::[A-Za-z_][A-Za-z0-9_]*)*\z/u
not defined $class
ref $class
not $class =~ /\A[A-Za-z_][A-Za-z0-9_]*(?:::[A-Za-z_][A-Za-z0-9_]*)*\z/u
Truth table25%1/4
not(A) or B or not(C)
A= not defined $classB= ref $classC= not $class =~ /\A[A-Za-z_][A-Za-z0-9_]*(?:::[A-Za-z_][A-Za-z0-9_]*)*\z/u
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | if !defined($class) || ref($class) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | || $class !~ /\A[A-Za-z_][A-Za-z0-9_]*(?:::[A-Za-z_][A-Za-z0-9_]*)*\z/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 20 | ▶ | if (!$class->can('connect')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 0 | (my $file = "$class.pm") =~ s{::}{/}g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | require $file; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 20 | ▶ | croak 'new(): connection_class must inherit Linux::Event::HTTP::Client::Connection' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | if !$class->isa('Linux::Event::HTTP::Client::Connection'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 20 | return $class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 1 | ▶ | sub _validate_tls_options ($option) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_validate_tls_options: called CC=3 SCAR=11.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 1 | ▶ | croak 'new(): tls must be a hash reference' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | if ref($option) ne 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 1 | my %known = map { $_ => 1 } qw( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | verify ca_file ca_path handshake_timeout shutdown_timeout | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 1 | my @unknown = grep { !$known{$_} } keys %$option; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 1 | ▶ | croak 'new(): tls has unknown options: ' . join(', ', sort @unknown) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | if @unknown; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 1 | return { %$option }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 63 | ▶ | sub _validate_max_redirects ($value, $where) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_validate_max_redirects: called CC=4 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 63 | ▶ | croak "$where: max_redirects must be a non-negative integer" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
not defined $value or ref $value or not "$value" =~ /\A[0-9]+\z/u
not defined $value or ref $value
MC/DC0%0/3
not defined $value or ref $value or not "$value" =~ /\A[0-9]+\z/u
not defined $value
ref $value
not "$value" =~ /\A[0-9]+\z/u
Truth table25%1/4
not(A) or B or not(C)
A= not defined $valueB= ref $valueC= not "$value" =~ /\A[0-9]+\z/u
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | if !defined($value) || ref($value) || "$value" !~ /\A[0-9]+\z/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 63 | return 0 + $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 66 | ▶ | sub _validate_max_auth_retries ($value, $where) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_validate_max_auth_retries: called CC=4 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 66 | ▶ | croak "$where: max_auth_retries must be a non-negative integer" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
not defined $value or ref $value or not "$value" =~ /\A[0-9]+\z/u
not defined $value or ref $value
MC/DC0%0/3
not defined $value or ref $value or not "$value" =~ /\A[0-9]+\z/u
not defined $value
ref $value
not "$value" =~ /\A[0-9]+\z/u
Truth table25%1/4
not(A) or B or not(C)
A= not defined $valueB= ref $valueC= not "$value" =~ /\A[0-9]+\z/u
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | if !defined($value) || ref($value) || "$value" !~ /\A[0-9]+\z/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 66 | return 0 + $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 158 | ▶ | sub _parse_url ($url) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_parse_url: called CC=21 SCAR=33.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 158 | ▶ | croak 'request(): URL must be a scalar' if !defined($url) || ref($url); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not defined $url or ref $url
MC/DC0%0/2
not defined $url or ref $url
not defined $url
ref $url
Truth table33%1/3
not(A) or B
A= not defined $urlB= ref $url
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 158 | my $uri = eval { URI->new("$url") }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 158 | ▶ | croak "request(): invalid URL: $@" if !$uri; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 158 | ▶ | my $scheme = lc($uri->scheme // ''); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$uri->scheme // ""
MC/DC100%1/1
$uri->scheme // ""
$uri->scheme
Truth table100%2/2
A
A= $uri->scheme
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 158 | ▶ | croak 'request(): URL scheme must be http or https' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$scheme ne "http" and $scheme ne "https"
MC/DC100%2/2
$scheme ne "http" and $scheme ne "https"
$scheme ne "http"
$scheme ne "https"
Truth table100%3/3
A and B
A= $scheme ne "http"B= $scheme ne "https"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | if $scheme ne 'http' && $scheme ne 'https'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 155 | my $host = $uri->host; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 155 | ▶ | croak 'request(): URL must contain a host' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not defined $host or $host eq ""
MC/DC0%0/2
not defined $host or $host eq ""
not defined $host
$host eq ""
Truth table33%1/3
not(A) or B
A= not defined $hostB= $host eq ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | if !defined($host) || $host eq ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 155 | ▶ | croak 'request(): URL userinfo is not supported; use explicit authentication policy' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $uri->userinfo and length $uri->userinfo
MC/DC50%1/2
defined $uri->userinfo and length $uri->userinfo
defined $uri->userinfo
length $uri->userinfo
Truth table66%2/3
A and B
A= defined $uri->userinfoB= length $uri->userinfo
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | if defined($uri->userinfo) && length($uri->userinfo); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 154 | my $port = eval { $uri->port }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 154 | ▶ | croak "request(): invalid URL port: $@" if !defined($port) || $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not defined $port or $@
MC/DC0%0/2
not defined $port or $@
not defined $port
$@
Truth table33%1/3
not(A) or B
A= not defined $portB= $@
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 154 | ▶ | croak 'request(): URL port must be between 1 and 65535' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
not $port =~ /\A[0-9]+\z/u or $port < 1 or $port > 65535
not $port =~ /\A[0-9]+\z/u or $port < 1
MC/DC0%0/3
not $port =~ /\A[0-9]+\z/u or $port < 1 or $port > 65535
not $port =~ /\A[0-9]+\z/u
$port < 1
$port > 65535
Truth table25%1/4
not(A) or B or C
A= not $port =~ /\A[0-9]+\z/uB= $port < 1C= $port > 65535
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | if $port !~ /\A[0-9]+\z/ || $port < 1 || $port > 65_535; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 154 | my $target = $uri->path_query; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 154 | ▶ | $target = '/' if !defined($target) || $target eq ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not defined $target or $target eq ""
MC/DC50%1/2
not defined $target or $target eq ""
not defined $target
$target eq ""
Truth table66%2/3
not(A) or B
A= not defined $targetB= $target eq ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 154 | ▶ | my $default_port = $scheme eq 'https' ? 443 : 80; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 154 | ▶ | my $authority_host = $host =~ /:/ ? "[$host]" : $host; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 154 | my $host_header = $authority_host; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 154 | ▶ | $host_header .= ":$port" if $port != $default_port; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 154 | my $absolute_target = "$scheme://$host_header$target"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 154 | my $auth_origin = "$scheme://$authority_host:$port"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 154 | my $origin = join("\0", $scheme, lc($host), $port); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | return { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 154 | scheme => $scheme, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | host => $host, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | port => 0 + $port, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | target => "$target", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | absolute_target => $absolute_target, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | host_header => $host_header, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | auth_origin => $auth_origin, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | origin => $origin, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 39 | ▶ | sub _parse_proxy_url ($url, $where = 'request()') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_parse_proxy_url: called CC=7 SCAR=20.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 39 | ▶ | croak "$where: proxy must be a non-empty scalar URL" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
not defined $url or ref $url or $url eq ""
not defined $url or ref $url
MC/DC0%0/3
not defined $url or ref $url or $url eq ""
not defined $url
ref $url
$url eq ""
Truth table25%1/4
not(A) or B or C
A= not defined $urlB= ref $urlC= $url eq ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | if !defined($url) || ref($url) || $url eq ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 39 | my $destination; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 39 | my $ok = eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 39 | $destination = _parse_url($url); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 38 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 39 | ▶ | if (!$ok) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 1 | my $error = "$@"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 1 | $error =~ s/\Arequest\(\)/$where/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 1 | die $error; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | croak "$where: proxy URL must not contain a path or query" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 38 | ▶ | if $destination->{target} ne '/'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 36 | return $destination; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | ▶ | sub _http2_available () { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_http2_available: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | ▶ | return 0 if !eval { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | require Net::HTTP2::nghttp2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | Net::HTTP2::nghttp2->VERSION('0.011'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | require Linux::Event::HTTP::_HTTP2::ClientSelector; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | ▶ | return Net::HTTP2::nghttp2->available ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 20 | ▶ | sub new ($class, %option) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=41 SCAR=46.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | my $loop = delete $option{loop} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 20 | ▶ | // croak 'new(): loop is required'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
delete $option{"loop"} // croak("new(): loop is required")
MC/DC0%0/2
delete $option{"loop"} // croak("new(): loop is required")
delete $option{"loop"}
croak("new(): loop is required")
Truth table33%1/3
A // B
A= delete $option{"loop"}B= croak("new(): loop is required")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 20 | ▶ | croak 'new(): loop must be an object implementing add() and watch_fd()' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
builtin::blessed($loop) and $loop->can("add") and $loop->can("watch_fd")
builtin::blessed($loop) and $loop->can("add")
MC/DC0%0/3
builtin::blessed($loop) and $loop->can("add") and $loop->can("watch_fd")
builtin::blessed($loop)
$loop->can("add")
$loop->can("watch_fd")
Truth table25%1/4
A and B and C
A= builtin::blessed($loop)B= $loop->can("add")C= $loop->can("watch_fd")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | if !blessed($loop) || !$loop->can('add') || !$loop->can('watch_fd'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 20 | my $connection_class_option = delete $option{connection_class}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 20 | ▶ | my $connection_class = _load_connection_class( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$connection_class_option // "Linux::Event::HTTP::Client::Connection"
MC/DC100%1/1
$connection_class_option // "Linux::Event::HTTP::Client::Connection"
$connection_class_option
Truth table100%2/2
A
A= $connection_class_option
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | $connection_class_option | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | // 'Linux::Event::HTTP::Client::Connection', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 20 | ▶ | my $http2 = exists($option{http2}) ? delete($option{http2}) : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | my $has_http2_max_header_list_size = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 20 | exists $option{http2_max_header_list_size}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | my $http2_max_header_list_size = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | $has_http2_max_header_list_size | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | ? delete($option{http2_max_header_list_size}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 20 | ▶ | : 65_536; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | my $has_http2_max_buffered_response_bytes = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 20 | exists $option{http2_max_buffered_response_bytes}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | my $http2_max_buffered_response_bytes = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | $has_http2_max_buffered_response_bytes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | ? delete($option{http2_max_buffered_response_bytes}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 20 | ▶ | : 67_108_864; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 20 | ▶ | croak 'new(): http2 must be zero or one' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
not defined $http2 or ref $http2 or "$http2" ne 0 and "$http2" ne 1
not defined $http2 or ref $http2
"$http2" ne 0 and "$http2" ne 1
MC/DC0%0/4
not defined $http2 or ref $http2 or "$http2" ne 0 and "$http2" ne 1
not defined $http2
ref $http2
"$http2" ne 0
"$http2" ne 1
Truth table20%1/5
not(A) or B or C and D
A= not defined $http2B= ref $http2C= "$http2" ne 0D= "$http2" ne 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | if !defined($http2) || ref($http2) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | || ("$http2" ne '0' && "$http2" ne '1'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 20 | ▶ | $http2 = $http2 ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 20 | ▶ | croak 'new(): http2_max_header_list_size must be a positive integer' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
ref $http2_max_header_list_size or not "$http2_max_header_list_size" =~ /\A[0-9]+\z/u or $http2_max_header_list_size < 1
ref $http2_max_header_list_size or not "$http2_max_header_list_size" =~ /\A[0-9]+\z/u
MC/DC0%0/3
ref $http2_max_header_list_size or not "$http2_max_header_list_size" =~ /\A[0-9]+\z/u or $http2_max_header_list_size < 1
ref $http2_max_header_list_size
not "$http2_max_header_list_size" =~ /\A[0-9]+\z/u
$http2_max_header_list_size < 1
Truth table25%1/4
A or not(B) or C
A= ref $http2_max_header_list_sizeB= not "$http2_max_header_list_size" =~ /\A[0-9]+\z/uC= $http2_max_header_list_size < 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | if ref($http2_max_header_list_size) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | || "$http2_max_header_list_size" !~ /\A[0-9]+\z/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | || $http2_max_header_list_size < 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 20 | ▶ | croak 'new(): http2_max_header_list_size requires http2 => 1' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not $http2 and $has_http2_max_header_list_size
MC/DC0%0/2
not $http2 and $has_http2_max_header_list_size
not $http2
$has_http2_max_header_list_size
Truth table33%1/3
not(A) and B
A= not $http2B= $has_http2_max_header_list_size
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | if !$http2 && $has_http2_max_header_list_size; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 20 | ▶ | croak 'new(): http2_max_buffered_response_bytes must be a positive integer' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
ref $http2_max_buffered_response_bytes or not "$http2_max_buffered_response_bytes" =~ /\A[0-9]+\z/u or $http2_max_buffered_response_bytes < 1
ref $http2_max_buffered_response_bytes or not "$http2_max_buffered_response_bytes" =~ /\A[0-9]+\z/u
MC/DC0%0/3
ref $http2_max_buffered_response_bytes or not "$http2_max_buffered_response_bytes" =~ /\A[0-9]+\z/u or $http2_max_buffered_response_bytes < 1
ref $http2_max_buffered_response_bytes
not "$http2_max_buffered_response_bytes" =~ /\A[0-9]+\z/u
$http2_max_buffered_response_bytes < 1
Truth table25%1/4
A or not(B) or C
A= ref $http2_max_buffered_response_bytesB= not "$http2_max_buffered_response_bytes" =~ /\A[0-9]+\z/uC= $http2_max_buffered_response_bytes < 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | if ref($http2_max_buffered_response_bytes) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | || "$http2_max_buffered_response_bytes" !~ /\A[0-9]+\z/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | || $http2_max_buffered_response_bytes < 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 20 | ▶ | croak 'new(): http2_max_buffered_response_bytes requires http2 => 1' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not $http2 and $has_http2_max_buffered_response_bytes
MC/DC0%0/2
not $http2 and $has_http2_max_buffered_response_bytes
not $http2
$has_http2_max_buffered_response_bytes
Truth table33%1/3
not(A) and B
A= not $http2B= $has_http2_max_buffered_response_bytes
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | if !$http2 && $has_http2_max_buffered_response_bytes; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 20 | ▶ | croak 'new(): http2 currently requires the default connection_class' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$http2 and defined $connection_class_option
MC/DC0%0/2
$http2 and defined $connection_class_option
$http2
defined $connection_class_option
Truth table33%1/3
A and B
A= $http2B= defined $connection_class_option
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | if $http2 && defined($connection_class_option); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 20 | ▶ | croak 'new(): HTTP/2 support requires Net::HTTP2::nghttp2 0.011 or newer' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$http2 and not _http2_available()
MC/DC0%0/2
$http2 and not _http2_available()
$http2
not _http2_available()
Truth table33%1/3
A and not(B)
A= $http2B= not _http2_available()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | if $http2 && !_http2_available(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 20 | my $connect_timeout = delete $option{connect_timeout}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | my $max_redirects = _validate_max_redirects( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 20 | ▶ | exists($option{max_redirects}) ? delete($option{max_redirects}) : 5, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 'new()', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | my $max_auth_retries = _validate_max_auth_retries( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | exists($option{max_auth_retries}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | ? delete($option{max_auth_retries}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 20 | ▶ | : 3, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 'new()', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | my $tls = exists($option{tls}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | ? _validate_tls_options(delete $option{tls}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 20 | ▶ | : {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | my $proxy_url = exists($option{proxy}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | ? delete($option{proxy}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 20 | ▶ | : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 20 | ▶ | _parse_proxy_url($proxy_url, 'new()') if defined $proxy_url; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | my $cookie_jar = exists($option{cookie_jar}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | ? delete($option{cookie_jar}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 19 | ▶ | : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 19 | ▶ | croak 'new(): cookie_jar must be an HTTP::CookieJar object' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
defined $cookie_jar and not builtin::blessed($cookie_jar) && $cookie_jar->isa("HTTP::CookieJar")
builtin::blessed($cookie_jar) && $cookie_jar->isa('HTTP::CookieJar')
MC/DC66%2/3
defined $cookie_jar and not builtin::blessed($cookie_jar) && $cookie_jar->isa("HTTP::CookieJar")
defined $cookie_jar
builtin::blessed($cookie_jar)
$cookie_jar->isa('HTTP::CookieJar')
Truth table75%3/4
A and not(B && C)
A= defined $cookie_jarB= builtin::blessed($cookie_jar)C= $cookie_jar->isa('HTTP::CookieJar')
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | if defined($cookie_jar) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | && (!blessed($cookie_jar) || !$cookie_jar->isa('HTTP::CookieJar')); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 18 | ▶ | my $auth = exists($option{auth}) ? delete($option{auth}) : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | my $proxy_auth = exists($option{proxy_auth}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | ? delete($option{proxy_auth}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 18 | ▶ | : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 18 | Linux::Event::HTTP::_ClientAuth::validate_manager($auth, 'new()', 'auth'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 18 | Linux::Event::HTTP::_ClientAuth::validate_manager( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | $proxy_auth, 'new()', 'proxy_auth', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 18 | ▶ | croak 'new(): unknown options: ' . join(', ', sort keys %option) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | if %option; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 18 | ▶ | return bless { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | loop => $loop, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | connection_class => $connection_class, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | connect_timeout => $connect_timeout, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | max_redirects => $max_redirects, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | max_auth_retries => $max_auth_retries, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | tls => $tls, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | proxy_url => defined($proxy_url) ? "$proxy_url" : undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | cookie_jar => $cookie_jar, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | auth => $auth, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | proxy_auth => $proxy_auth, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | http2 => $http2, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | http2_max_header_list_size => 0 + $http2_max_header_list_size, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | http2_max_buffered_response_bytes => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 + $http2_max_buffered_response_bytes, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | idle => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | h2_pool => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | h2_negotiating => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | connections => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | closed => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | }, $class; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 1 | ▶ | sub loop ($self) { $self->{loop} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
loop: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 1 | ▶ | sub connection_class ($self) { $self->{connection_class} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
connection_class: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 1 | ▶ | sub max_redirects ($self) { $self->{max_redirects} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
max_redirects: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | ▶ | sub max_auth_retries ($self) { $self->{max_auth_retries} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
max_auth_retries: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 2 | ▶ | sub proxy ($self) { $self->{proxy_url} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
proxy: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 1 | ▶ | sub cookie_jar ($self) { $self->{cookie_jar} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cookie_jar: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | ▶ | sub auth ($self) { $self->{auth} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
auth: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | ▶ | sub proxy_auth ($self) { $self->{proxy_auth} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
proxy_auth: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | ▶ | sub http2 ($self) { !!$self->{http2} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
http2: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | ▶ | sub http2_max_header_list_size ($self) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
http2_max_header_list_size: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 0 | return $self->{http2_max_header_list_size}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 0 | ▶ | sub http2_max_buffered_response_bytes ($self) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
http2_max_buffered_response_bytes: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | return $self->{http2_max_buffered_response_bytes}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 4 | ▶ | sub is_closed ($self) { !!$self->{closed} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_closed: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 108 | ▶ | sub _copy_headers ($headers) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_copy_headers: called CC=6 SCAR=18.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 108 | ▶ | return [] if !defined $headers; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 71 | ▶ | croak 'request(): headers must be an array reference of [name, value] pairs' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | if ref($headers) ne 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 71 | my @copy; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 71 | for my $pair (@$headers) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 52 | ▶ | croak 'request(): each header must be a [name, value] pair' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
ref $pair ne "ARRAY" or @$pair != 2
MC/DC0%0/2
ref $pair ne "ARRAY" or @$pair != 2
ref $pair ne "ARRAY"
@$pair != 2
Truth table33%1/3
A or B
A= ref $pair ne "ARRAY"B= @$pair != 2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | if ref($pair) ne 'ARRAY' || @$pair != 2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 52 | push @copy, [ $pair->[0], $pair->[1] ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 71 | return \@copy; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 16 | ▶ | sub _validate_buffer_body ($value) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_validate_buffer_body: called CC=5 SCAR=18.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 16 | ▶ | croak 'request(): buffer_body must be a positive integer byte limit' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
not defined $value or ref $value or not "$value" =~ /\A[0-9]+\z/u
not defined $value or ref $value
MC/DC0%0/3
not defined $value or ref $value or not "$value" =~ /\A[0-9]+\z/u
not defined $value
ref $value
not "$value" =~ /\A[0-9]+\z/u
Truth table25%1/4
not(A) or B or not(C)
A= not defined $valueB= ref $valueC= not "$value" =~ /\A[0-9]+\z/u
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | if !defined($value) || ref($value) || "$value" !~ /\A[0-9]+\z/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 16 | ▶ | croak 'request(): buffer_body must be greater than zero' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | if "$value" !~ /[1-9]/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 15 | return "$value"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 10 | ▶ | sub _validate_stream_body ($value) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_validate_stream_body: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 10 | ▶ | croak 'request(): stream_body must be a hash reference' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | if ref($value) ne 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 10 | my $copy = { %$value }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 10 | require Linux::Event::HTTP::Body::Stream; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 10 | Linux::Event::HTTP::Body::Stream->_validate_options('request', %$copy); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 9 | return $copy; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 35 | ▶ | sub _track_connection ($self, $connection) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_track_connection: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 35 | my $id = refaddr($connection); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 35 | $self->{connections}{$id} = $connection; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 35 | weaken($self->{connections}{$id}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 35 | return $connection; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 0 | ▶ | sub _register_negotiating_connection ($self, $origin, $connection) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_register_negotiating_connection: not called CC=11 SCAR=48.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 0 | ▶ | return if $self->{closed} || !$connection || $connection->is_closed; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$self->{"closed"} or not $connection or $connection->is_closed
$self->{"closed"} or not $connection
MC/DC0%0/3
$self->{"closed"} or not $connection or $connection->is_closed
$self->{"closed"}
not $connection
$connection->is_closed
Truth table0%0/4
A or not(B) or C
A= $self->{"closed"}B= not $connectionC= $connection->is_closed
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 0 | ▶ | return if !$connection->can('_http2_capable') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$connection->can("_http2_capable") and $connection->_http2_capable
MC/DC0%0/2
$connection->can("_http2_capable") and $connection->_http2_capable
$connection->can("_http2_capable")
$connection->_http2_capable
Truth table0%0/3
A and B
A= $connection->can("_http2_capable")B= $connection->_http2_capable
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | || !$connection->_http2_capable; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 0 | ▶ | my $protocol = $connection->protocol // ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$connection->protocol // ""
MC/DC0%0/1
$connection->protocol // ""
$connection->protocol
Truth table0%0/2
A
A= $connection->protocol
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 0 | ▶ | return if $protocol ne 'negotiating' && $protocol ne 'selecting-h2'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$protocol ne "negotiating" and $protocol ne "selecting-h2"
MC/DC0%0/2
$protocol ne "negotiating" and $protocol ne "selecting-h2"
$protocol ne "negotiating"
$protocol ne "selecting-h2"
Truth table0%0/3
A and B
A= $protocol ne "negotiating"B= $protocol ne "selecting-h2"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 0 | ▶ | my $pool = $self->{h2_negotiating}{$origin} //= []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{"h2_negotiating"}{$origin} //= []
MC/DC0%0/1
$self->{"h2_negotiating"}{$origin} //= []
$self->{"h2_negotiating"}{$origin}
Truth table0%0/2
A
A= $self->{"h2_negotiating"}{$origin}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 0 | my $id = refaddr($connection); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 0 | ▶ | return $connection if grep { refaddr($_) == $id } @$pool; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 0 | push @$pool, $connection; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | return $connection; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 0 | ▶ | sub _remove_negotiating_connection ($self, $origin, $connection) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_remove_negotiating_connection: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 0 | ▶ | my $pool = $self->{h2_negotiating}{$origin} or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 0 | my $id = refaddr($connection); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | my @keep = grep { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 0 | ▶ | $_ && refaddr($_) != $id && !$_->is_closed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
$_ && builtin::refaddr($_) != $id && !$_->is_closed
$_ and builtin::refaddr($_) != $id
MC/DC0%0/3
$_ && builtin::refaddr($_) != $id && !$_->is_closed
$_
builtin::refaddr($_) != $id
!$_->is_closed
Truth table0%0/4
A and B && not(C)
A= $_B= builtin::refaddr($_) != $idC= !$_->is_closed
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | } @$pool; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 0 | ▶ | if (@keep) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 0 | $self->{h2_negotiating}{$origin} = \@keep; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 0 | delete $self->{h2_negotiating}{$origin}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 0 | ▶ | sub _take_negotiating_connection ($self, $origin) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_take_negotiating_connection: not called CC=11 SCAR=48.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 0 | ▶ | my $pool = $self->{h2_negotiating}{$origin} or return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 0 | my @keep; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | my $selected; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | for my $connection (@$pool) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 0 | ▶ | next if !$connection || $connection->is_closed; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $connection or $connection->is_closed
MC/DC0%0/2
not $connection or $connection->is_closed
not $connection
$connection->is_closed
Truth table0%0/3
not(A) or B
A= not $connectionB= $connection->is_closed
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 0 | ▶ | my $protocol = $connection->protocol // ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$connection->protocol // ""
MC/DC0%0/1
$connection->protocol // ""
$connection->protocol
Truth table0%0/2
A
A= $connection->protocol
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 0 | ▶ | next if $protocol ne 'negotiating' && $protocol ne 'selecting-h2'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$protocol ne "negotiating" and $protocol ne "selecting-h2"
MC/DC0%0/2
$protocol ne "negotiating" and $protocol ne "selecting-h2"
$protocol ne "negotiating"
$protocol ne "selecting-h2"
Truth table0%0/3
A and B
A= $protocol ne "negotiating"B= $protocol ne "selecting-h2"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 0 | push @keep, $connection; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 0 | ▶ | $selected //= $connection | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$selected //= $connection
MC/DC0%0/2
$selected //= $connection
$selected
$connection
Truth table0%0/3
A //= B
A= $selectedB= $connection
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | if $connection->can_queue_transaction; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 0 | ▶ | if (@keep) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 0 | $self->{h2_negotiating}{$origin} = \@keep; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 0 | delete $self->{h2_negotiating}{$origin}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | return $selected; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 0 | ▶ | sub _register_h2_connection ($self, $origin, $connection) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_register_h2_connection: not called CC=10 SCAR=47.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 0 | ▶ | return if $self->{closed} || !$connection || $connection->is_closed; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$self->{"closed"} or not $connection or $connection->is_closed
$self->{"closed"} or not $connection
MC/DC0%0/3
$self->{"closed"} or not $connection or $connection->is_closed
$self->{"closed"}
not $connection
$connection->is_closed
Truth table0%0/4
A or not(B) or C
A= $self->{"closed"}B= not $connectionC= $connection->is_closed
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 0 | ▶ | return if !$connection->can('_http2_capable') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$connection->can("_http2_capable") and $connection->_http2_capable
MC/DC0%0/2
$connection->can("_http2_capable") and $connection->_http2_capable
$connection->can("_http2_capable")
$connection->_http2_capable
Truth table0%0/3
A and B
A= $connection->can("_http2_capable")B= $connection->_http2_capable
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | || !$connection->_http2_capable; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 0 | ▶ | return if ($connection->protocol // '') ne 'h2'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$connection->protocol // ""
MC/DC0%0/1
$connection->protocol // ""
$connection->protocol
Truth table0%0/2
A
A= $connection->protocol
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 0 | ▶ | my $pool = $self->{h2_pool}{$origin} //= []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{"h2_pool"}{$origin} //= []
MC/DC0%0/1
$self->{"h2_pool"}{$origin} //= []
$self->{"h2_pool"}{$origin}
Truth table0%0/2
A
A= $self->{"h2_pool"}{$origin}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 0 | my $id = refaddr($connection); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 0 | ▶ | return $connection if grep { refaddr($_) == $id } @$pool; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 0 | push @$pool, $connection; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | 0 | return $connection; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 0 | ▶ | sub _take_h2_connection ($self, $origin) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_take_h2_connection: not called CC=11 SCAR=48.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | 0 | ▶ | my $pool = $self->{h2_pool}{$origin} or return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 0 | my @keep; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | my $selected; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 0 | for my $connection (@$pool) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 0 | ▶ | next if !$connection || $connection->is_closed; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $connection or $connection->is_closed
MC/DC0%0/2
not $connection or $connection->is_closed
not $connection
$connection->is_closed
Truth table0%0/3
not(A) or B
A= not $connectionB= $connection->is_closed
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 0 | ▶ | if (($connection->protocol // '') ne 'h2') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$connection->protocol // ""
MC/DC0%0/1
$connection->protocol // ""
$connection->protocol
Truth table0%0/2
A
A= $connection->protocol
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | 0 | ▶ | if (!$connection->can_accept_transaction) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 0 | ▶ | if ($connection->active_streams == 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 0 | $connection->close; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 0 | push @keep, $connection; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 0 | push @keep, $connection; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 0 | ▶ | $selected //= $connection; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$selected //= $connection
MC/DC0%0/2
$selected //= $connection
$selected
$connection
Truth table0%0/3
A //= B
A= $selectedB= $connection
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 0 | ▶ | if (@keep) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 0 | $self->{h2_pool}{$origin} = \@keep; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 0 | delete $self->{h2_pool}{$origin}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 0 | return $selected; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 58 | ▶ | sub _take_idle_connection ($self, $origin, $allow_http2 = 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_take_idle_connection: called CC=13 SCAR=35.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 58 | my $connection = delete $self->{idle}{$origin}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 58 | ▶ | return undef if !$connection; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 23 | ▶ | return undef if $connection->is_closed; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 23 | ▶ | return undef if defined $connection->transaction; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | 23 | ▶ | my $is_selector = $connection->can('_http2_capable') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$connection->can("_http2_capable") and $connection->_http2_capable
MC/DC0%0/2
$connection->can("_http2_capable") and $connection->_http2_capable
$connection->can("_http2_capable")
$connection->_http2_capable
Truth table33%1/3
A and B
A= $connection->can("_http2_capable")B= $connection->_http2_capable
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | && $connection->_http2_capable ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | 23 | ▶ | if ($is_selector && ($connection->protocol // '') eq 'h2') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition20%1/5
$is_selector and ($connection->protocol // "") eq "h2"
$connection->protocol // ""
MC/DC0%0/2
$is_selector and ($connection->protocol // "") eq "h2"
$is_selector
$connection->protocol
Truth table33%1/3
A and B
A= $is_selectorB= $connection->protocol
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | 0 | $self->_register_h2_connection($origin, $connection); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | 0 | ▶ | return $allow_http2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | ? $self->_take_h2_connection($origin) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | 23 | ▶ | if ($allow_http2 && !$is_selector) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$allow_http2 and not $is_selector
MC/DC0%0/2
$allow_http2 and not $is_selector
$allow_http2
not $is_selector
Truth table33%1/3
A and not(B)
A= $allow_http2B= not $is_selector
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 0 | $connection->close; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | 23 | return $connection; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | 35 | ▶ | sub _new_connection ($self, $destination, $allow_http2 = 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_new_connection: called CC=7 SCAR=26.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | my %connect = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | loop => $self->{loop}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | host => $destination->{host}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | port => $destination->{port}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | 35 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | $connect{timeout} = $self->{connect_timeout} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | 35 | ▶ | if defined $self->{connect_timeout}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | 35 | ▶ | if ($destination->{scheme} eq 'https') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 1 | require Linux::Event::TLS; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | $connect{transport} = Linux::Event::TLS->client( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | server_name => $destination->{host}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | alpn => $allow_http2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | ? [ 'h2', 'http/1.1' ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | : [ 'http/1.1' ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 1 | ▶ | %{$self->{tls}}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 35 | my $connection; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 35 | ▶ | if ($allow_http2 && $destination->{scheme} eq 'https') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$allow_http2 and $destination->{"scheme"} eq "https"
MC/DC0%0/2
$allow_http2 and $destination->{"scheme"} eq "https"
$allow_http2
$destination->{"scheme"} eq "https"
Truth table33%1/3
A and B
A= $allow_http2B= $destination->{"scheme"} eq "https"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | 0 | require Linux::Event::HTTP::_HTTP2::ClientSelector; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | 0 | my $weak_self = $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | 0 | weaken($weak_self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | 0 | my $origin = $destination->{origin}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | $connection = Linux::Event::HTTP::_HTTP2::ClientSelector->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | %connect, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | scheme => $destination->{scheme}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | authority => $destination->{host_header}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | max_header_list_size => $self->{http2_max_header_list_size}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | max_buffered_response_bytes => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | $self->{http2_max_buffered_response_bytes}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | 0 | ▶ | http1_connection_factory => sub ($selected) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | 0 | ▶ | my $client = $weak_self | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | or die 'HTTP Client disappeared during ALPN selection'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | 0 | return $client->_new_connection($destination, 0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | 0 | ▶ | on_selected => sub ($selected, $protocol) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | 0 | ▶ | my $client = $weak_self or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 0 | $client->_remove_negotiating_connection( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | $origin, $selected, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | 0 | ▶ | $client->_register_h2_connection($origin, $selected) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | if $protocol eq 'h2'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | 0 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 0 | $self->_register_negotiating_connection($origin, $connection); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | 35 | $connection = $self->{connection_class}->connect(%connect); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | 35 | return $self->_track_connection($connection); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | 58 | ▶ | sub _connection_for ($self, $destination, $allow_http2 = 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_connection_for: called CC=6 SCAR=26.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 58 | ▶ | if ($allow_http2) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | 0 | my $h2 = $self->_take_h2_connection($destination->{origin}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 0 | ▶ | return $h2 if $h2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | my $negotiating = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | 0 | $self->_take_negotiating_connection($destination->{origin}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 0 | ▶ | return $negotiating if $negotiating; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | return $self->_take_idle_connection( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 58 | ▶ | $destination->{origin}, $allow_http2, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$self->_take_idle_connection($destination->{"origin"}, $allow_http2) // $self->_new_connection($destination, $allow_http2)
MC/DC0%0/2
$self->_take_idle_connection($destination->{"origin"}, $allow_http2) // $self->_new_connection($destination, $allow_http2)
$self->_take_idle_connection($destination->{"origin"}, $allow_http2)
$self->_new_connection($destination, $allow_http2)
Truth table66%2/3
A // B
A= $self->_take_idle_connection($destination->{"origin"}, $allow_http2)B= $self->_new_connection($destination, $allow_http2)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | ) // $self->_new_connection($destination, $allow_http2); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | 51 | ▶ | sub _release_connection ($self, $origin, $connection) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_release_connection: called CC=13 SCAR=32.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | 51 | ▶ | return if $self->{closed}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | 51 | ▶ | return if !$connection || $connection->is_closed; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not $connection or $connection->is_closed
MC/DC50%1/2
not $connection or $connection->is_closed
not $connection
$connection->is_closed
Truth table66%2/3
not(A) or B
A= not $connectionB= $connection->is_closed
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | 47 | ▶ | if ($connection->can('_http2_capable') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition25%2/8
$connection->can("_http2_capable") and $connection->_http2_capable and ($connection->protocol // "") eq "h2"
$connection->can("_http2_capable") and $connection->_http2_capable
$connection->protocol // ""
MC/DC0%0/3
$connection->can("_http2_capable") and $connection->_http2_capable and ($connection->protocol // "") eq "h2"
$connection->can("_http2_capable")
$connection->_http2_capable
$connection->protocol
Truth table25%1/4
A and B and C
A= $connection->can("_http2_capable")B= $connection->_http2_capableC= $connection->protocol
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | && $connection->_http2_capable | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | && ($connection->protocol // '') eq 'h2') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | 0 | $self->_register_h2_connection($origin, $connection); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | 0 | $self->_take_h2_connection($origin); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | 47 | ▶ | return if defined $connection->transaction; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | 47 | ▶ | if (my $idle = $self->{idle}{$origin}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | 8 | ▶ | if (!$idle->is_closed && refaddr($idle) != refaddr($connection)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not $idle->is_closed and builtin::refaddr($idle) != builtin::refaddr($connection)
MC/DC0%0/2
not $idle->is_closed and builtin::refaddr($idle) != builtin::refaddr($connection)
not $idle->is_closed
builtin::refaddr($idle) != builtin::refaddr($connection)
Truth table33%1/3
not(A) and B
A= not $idle->is_closedB= builtin::refaddr($idle) != builtin::refaddr($connection)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | 8 | ▶ | if ($connection->can('end')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | 8 | $connection->end; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | 0 | $connection->close; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | 8 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | 39 | $self->{idle}{$origin} = $connection; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | 39 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | 11 | ▶ | sub _resolve_redirect_url ($current_url, $location) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_resolve_redirect_url: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 11 | my $base = URI->new("$current_url"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | 11 | my $reference = URI->new("$location"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | 11 | ▶ | my $inherit_fragment = !defined($reference->fragment) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | ? $base->fragment : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | 11 | my $next = URI->new_abs($reference, $base); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | 11 | ▶ | $next->fragment($inherit_fragment) if defined $inherit_fragment; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | 11 | return $next->as_string; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | 10 | ▶ | sub _redirect_headers ($headers, $drop_body, $cross_origin, $through_proxy = 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_redirect_headers: called CC=22 SCAR=35.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | 10 | my @next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | 10 | for my $pair (@$headers) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | 9 | my ($name, $value) = @$pair; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | 9 | ▶ | my $lower = defined($name) && !ref($name) ? lc($name) : ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $name and not ref $name
MC/DC0%0/2
defined $name and not ref $name
defined $name
not ref $name
Truth table33%1/3
A and not(B)
A= defined $nameB= not ref $name
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | 9 | ▶ | next if $lower eq 'host'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | 8 | ▶ | next if $lower eq 'connection'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | 7 | ▶ | next if $lower eq 'keep-alive'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | 7 | ▶ | next if $lower eq 'proxy-connection'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | 7 | ▶ | next if $lower eq 'proxy-authorization' && !$through_proxy; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$lower eq "proxy-authorization" and not $through_proxy
MC/DC0%0/2
$lower eq "proxy-authorization" and not $through_proxy
$lower eq "proxy-authorization"
not $through_proxy
Truth table66%2/3
A and not(B)
A= $lower eq "proxy-authorization"B= not $through_proxy
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | 7 | ▶ | next if $lower eq 'te'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | 7 | ▶ | next if $lower eq 'trailer'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | 7 | ▶ | next if $lower eq 'transfer-encoding'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | 7 | ▶ | next if $lower eq 'upgrade'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | 6 | ▶ | next if $lower eq 'content-length'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | 6 | ▶ | if ($cross_origin) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | 6 | ▶ | next if $lower eq 'authorization'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | 4 | ▶ | next if $lower eq 'cookie'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | 2 | ▶ | if ($drop_body) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | 0 | ▶ | next if $lower eq 'expect'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | 0 | ▶ | next if $lower =~ /\Acontent-/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | 2 | push @next, [ $name, $value ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | 10 | return \@next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | 47 | ▶ | sub _redirect_plan ($self, $operation, $spec, $destination, $response) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_redirect_plan: called CC=21 SCAR=31.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | 47 | my $status = $response->status; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | 47 | ▶ | return undef if !$REDIRECT_STATUS{$status}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | 13 | ▶ | return undef if $spec->{max_redirects} == 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | 12 | my $location = $response->header_values('Location'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | 12 | ▶ | return undef if !@$location; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | 12 | ▶ | return { error => 'redirect response contains multiple Location fields' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | if @$location != 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | return { error => 'maximum redirect count exceeded' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | 12 | ▶ | if $operation->redirect_count >= $spec->{max_redirects}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | 11 | my ($next_url, $next_destination); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | 11 | my $ok = eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | 11 | $next_url = _resolve_redirect_url($spec->{url}, $location->[0]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | 11 | $next_destination = _parse_url($next_url); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | 11 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | 11 | ▶ | if (!$ok) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | 0 | my $error = "$@"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | 0 | $error =~ s/\s+\z//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | 0 | return { error => "invalid redirect Location: $error" }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | 11 | my $method = $spec->{method}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | 11 | my $drop_body = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | 11 | ▶ | if ($status == 303) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | 1 | ▶ | $method = uc($method) eq 'HEAD' ? 'HEAD' : 'GET'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | 1 | $drop_body = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | ▶ | elsif (($status == 301 || $status == 302) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition83%5/6
$status == 301 || $status == 302 and uc $method eq "POST"
$status == 301 or $status == 302
MC/DC66%2/3
$status == 301 || $status == 302 and uc $method eq "POST"
$status == 301
$status == 302
uc $method eq "POST"
Truth table60%3/5
A or B and C
A= $status == 301B= $status == 302C= uc $method eq "POST"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | && uc($method) eq 'POST') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | 1 | $method = 'GET'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | 1 | $drop_body = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | 11 | ▶ | if (!$drop_body && $spec->{has_stream_body}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not $drop_body and $spec->{"has_stream_body"}
MC/DC100%2/2
not $drop_body and $spec->{"has_stream_body"}
not $drop_body
$spec->{"has_stream_body"}
Truth table100%3/3
not(A) and B
A= not $drop_bodyB= $spec->{"has_stream_body"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | return { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | 1 | error => "cannot automatically follow $status redirect for a streaming Request body because the producer is not replayable", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | my $headers = _redirect_headers( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | $spec->{headers}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | $drop_body, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | $destination->{origin} ne $next_destination->{origin}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | 10 | ▶ | defined($spec->{proxy_url}) ? 1 : 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | 10 | ▶ | if (defined $spec->{upgrade_to}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | 1 | push @$headers, [ Upgrade => $_->[1] ] for grep { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | 2 | ▶ | defined($_->[0]) && !ref($_->[0]) && lc($_->[0]) eq 'upgrade' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%3/6
defined $_->[0] && !ref($_->[0]) && lc $_->[0] eq 'upgrade'
defined $_->[0] and not ref $_->[0]
MC/DC33%1/3
defined $_->[0] && !ref($_->[0]) && lc $_->[0] eq 'upgrade'
defined $_->[0]
not ref $_->[0]
lc $_->[0] eq 'upgrade'
Truth table50%2/4
A and not(B) && C
A= defined $_->[0]B= not ref $_->[0]C= lc $_->[0] eq 'upgrade'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | 1 | } @{$spec->{headers}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | 1 | push @$headers, [ Connection => 'Upgrade' ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | my %next = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | url => $next_url, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | proxy_url => $spec->{proxy_url}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | method => $method, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | headers => $headers, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | version => $spec->{version}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | version_explicit => $spec->{version_explicit}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | has_body => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | body => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | has_stream_body => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | stream_body => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | has_buffer_body => $spec->{has_buffer_body}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | buffer_body => $spec->{buffer_body}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | max_redirects => $spec->{max_redirects}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | max_auth_retries => $spec->{max_auth_retries}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | auth => $spec->{auth}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | proxy_auth => $spec->{proxy_auth}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | authorization => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | proxy_authorization => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | upgrade_to => $spec->{upgrade_to}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | callback => $spec->{callback}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | 10 | hop_kind => 'redirect', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | 10 | ▶ | if (!$drop_body && $spec->{has_body}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not $drop_body and $spec->{"has_body"}
MC/DC100%2/2
not $drop_body and $spec->{"has_body"}
not $drop_body
$spec->{"has_body"}
Truth table100%3/3
not(A) and B
A= not $drop_bodyB= $spec->{"has_body"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | 1 | $next{has_body} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | 1 | $next{body} = $spec->{body}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | return { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | 10 | url => $next_url, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | spec => \%next, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | 51 | ▶ | sub _auth_retry_plan ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_auth_retry_plan: called CC=11 SCAR=24.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | $self, $operation, $spec, $destination, $proxy, $message, $response, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | 51 | ▶ | return undef if $spec->{max_auth_retries} == 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | 50 | ▶ | return undef if $operation->auth_retry_count >= $spec->{max_auth_retries}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | 50 | my $status = $response->status; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | 50 | my ($manager, $challenge_header, $origin, $field, $label); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | 50 | ▶ | if ($status == 401 && $spec->{auth}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
$status == 401 and $spec->{"auth"}
MC/DC50%1/2
$status == 401 and $spec->{"auth"}
$status == 401
$spec->{"auth"}
Truth table66%2/3
A and B
A= $status == 401B= $spec->{"auth"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | 3 | $manager = $spec->{auth}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | 3 | $challenge_header = 'WWW-Authenticate'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | 3 | $origin = $destination->{auth_origin}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | 3 | $field = 'authorization'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | 3 | $label = 'target'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | ▶ | elsif ($status == 407 && $proxy && $spec->{proxy_auth}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%4/6
$status == 407 and $proxy and $spec->{"proxy_auth"}
$status == 407 and $proxy
MC/DC33%1/3
$status == 407 and $proxy and $spec->{"proxy_auth"}
$status == 407
$proxy
$spec->{"proxy_auth"}
Truth table50%2/4
A and B and C
A= $status == 407B= $proxyC= $spec->{"proxy_auth"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | 1 | $manager = $spec->{proxy_auth}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | 1 | $challenge_header = 'Proxy-Authenticate'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | 1 | $origin = $proxy->{auth_origin}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | 1 | $field = 'proxy_authorization'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | 1 | $label = 'proxy'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | 46 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | 4 | my $prepared = Linux::Event::HTTP::_ClientAuth::prepare_retry( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | manager => $manager, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | response => $response, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | challenge_header => $challenge_header, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | origin => $origin, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | request => $message, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | status => $status, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | label => $label, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | 4 | ▶ | return undef if !$prepared; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | 4 | ▶ | return $prepared if defined $prepared->{error}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | 3 | my %next = %$spec; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | 3 | $next{hop_kind} = 'auth'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | 3 | $next{$field} = $prepared->{value}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | return { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | spec => \%next, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | scheme => $prepared->{scheme}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | 3 | ▶ | proxy => $status == 407 ? 1 : 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | 54 | ▶ | sub _start_operation_hop ($self, $operation, $spec) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_start_operation_hop: called CC=33 SCAR=40.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | 54 | ▶ | die 'cannot start another HTTP hop for a terminal Client operation' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | if $operation->is_terminal; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | 54 | my $destination = _parse_url($spec->{url}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | my $proxy = defined($spec->{proxy_url}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | ? _parse_proxy_url($spec->{proxy_url}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | 54 | ▶ | : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | 54 | ▶ | my $route = $proxy // $destination; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$proxy // $destination
MC/DC0%0/2
$proxy // $destination
$proxy
$destination
Truth table66%2/3
A // B
A= $proxyB= $destination
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | 54 | my $headers = _copy_headers($spec->{headers}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | 54 | my $cookie_url = $destination->{absolute_target}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | 54 | ▶ | if (my $jar = $self->{cookie_jar}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | 5 | my $cookie = $jar->cookie_header($cookie_url); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | 5 | ▶ | push @$headers, [ Cookie => $cookie ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $cookie and length $cookie
MC/DC50%1/2
defined $cookie and length $cookie
defined $cookie
length $cookie
Truth table66%2/3
A and B
A= defined $cookieB= length $cookie
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | if defined($cookie) && length($cookie); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | 54 | ▶ | if ($proxy) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | @$headers = grep { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | 14 | ▶ | !defined($_->[0]) || ref($_->[0]) || lc($_->[0]) ne 'host' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%3/6
!defined($_->[0]) || ref $_->[0] || lc $_->[0] ne 'host'
not defined $_->[0] or ref $_->[0]
MC/DC33%1/3
!defined($_->[0]) || ref $_->[0] || lc $_->[0] ne 'host'
not defined $_->[0]
ref $_->[0]
lc $_->[0] ne 'host'
Truth table50%2/4
not(A) or B || C
A= not defined $_->[0]B= ref $_->[0]C= lc $_->[0] ne 'host'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | } @$headers; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | 14 | push @$headers, [ Host => $destination->{host_header} ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | my @host = grep { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | 40 | ▶ | defined($_->[0]) && !ref($_->[0]) && lc($_->[0]) eq 'host' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%3/6
defined $_->[0] && !ref($_->[0]) && lc $_->[0] eq 'host'
defined $_->[0] and not ref $_->[0]
MC/DC33%1/3
defined $_->[0] && !ref($_->[0]) && lc $_->[0] eq 'host'
defined $_->[0]
not ref $_->[0]
lc $_->[0] eq 'host'
Truth table50%2/4
A and not(B) && C
A= defined $_->[0]B= not ref $_->[0]C= lc $_->[0] eq 'host'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | } @$headers; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | 40 | ▶ | push @$headers, [ Host => $destination->{host_header} ] if !@host; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | push @$headers, [ Authorization => $spec->{authorization} ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | 54 | ▶ | if defined $spec->{authorization}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | push @$headers, [ 'Proxy-Authorization' => $spec->{proxy_authorization} ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | 54 | ▶ | if defined $spec->{proxy_authorization}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | my %request = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | method => $spec->{method}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | target => $proxy | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | ? $destination->{absolute_target} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | : $destination->{target}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | version => $spec->{version}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | 54 | ▶ | headers => $headers, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | 54 | ▶ | $request{body} = $spec->{body} if $spec->{has_body}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | 54 | my $message = Linux::Event::HTTP::Request->new(%request); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | my $allow_http2 = $self->{http2} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | && !$proxy | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | && $destination->{scheme} eq 'https' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | && !$spec->{version_explicit} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | 54 | ▶ | && !defined($spec->{upgrade_to}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%4/12
$self->{'http2'} && !$proxy && $destination->{'scheme'} eq 'https' && !$spec->{'version_explicit'} && !defined($spec->{'upgrade_to'})
$self->{"http2"} and not $proxy and $destination->{"scheme"} eq "https" and not $spec->{"version_explicit"}
$self->{"http2"} and not $proxy and $destination->{"scheme"} eq "https"
$self->{"http2"} and not $proxy
MC/DC0%0/5
$self->{'http2'} && !$proxy && $destination->{'scheme'} eq 'https' && !$spec->{'version_explicit'} && !defined($spec->{'upgrade_to'})
$self->{"http2"}
not $proxy
$destination->{"scheme"} eq "https"
not $spec->{"version_explicit"}
!defined($spec->{'upgrade_to'})
Truth table16%1/6
A and not(B) and C and not(D) && not(E)
A= $self->{"http2"}B= not $proxyC= $destination->{"scheme"} eq "https"D= not $spec->{"version_explicit"}E= !defined($spec->{'upgrade_to'})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | 54 | my $connection = $self->_connection_for($route, $allow_http2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | 54 | my $callback = $spec->{callback}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | 54 | my ($auth_retry, $redirect); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | 54 | my $upgraded = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | 54 | my %connection_callback; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | 51 | ▶ | $connection_callback{on_response} = sub ($transaction, $response) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=9 SCAR=22.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | 51 | ▶ | if (my $jar = $self->{cookie_jar}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | $jar->add($cookie_url, $_) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | 5 | for @{$response->header_values('Set-Cookie')}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | 51 | $auth_retry = $self->_auth_retry_plan( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | $operation, $spec, $destination, $proxy, $message, $response, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | 51 | ▶ | $redirect = $self->_redirect_plan( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | $operation, $spec, $destination, $response, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | ) if !$auth_retry; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | 51 | ▶ | if (!$auth_retry && !$redirect && $callback->{on_response}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
not $auth_retry || $redirect and $callback->{"on_response"}
$auth_retry || $redirect
MC/DC100%3/3
not $auth_retry || $redirect and $callback->{"on_response"}
$auth_retry
$redirect
$callback->{"on_response"}
Truth table100%4/4
not(A || B) and C
A= $auth_retryB= $redirectC= $callback->{"on_response"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | 11 | $callback->{on_response}->($transaction, $response); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | 11 | ▶ | $operation->_mark_cancelled | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$transaction->is_cancelled and not $operation->is_terminal
MC/DC0%0/2
$transaction->is_cancelled and not $operation->is_terminal
$transaction->is_cancelled
not $operation->is_terminal
Truth table33%1/3
A and not(B)
A= $transaction->is_cancelledB= not $operation->is_terminal
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | if $transaction->is_cancelled && !$operation->is_terminal; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | 51 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | 54 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | 54 | ▶ | if ($callback->{on_body}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | 25 | ▶ | $connection_callback{on_body} = sub ($transaction, $response, $bytes) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=16.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | 25 | ▶ | return if $auth_retry || $redirect; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$auth_retry or $redirect
MC/DC100%2/2
$auth_retry or $redirect
$auth_retry
$redirect
Truth table100%3/3
A or B
A= $auth_retryB= $redirect
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | 21 | $callback->{on_body}->($transaction, $response, $bytes); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | 21 | ▶ | $operation->_mark_cancelled | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$transaction->is_cancelled and not $operation->is_terminal
MC/DC0%0/2
$transaction->is_cancelled and not $operation->is_terminal
$transaction->is_cancelled
not $operation->is_terminal
Truth table33%1/3
A and not(B)
A= $transaction->is_cancelledB= not $operation->is_terminal
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | if $transaction->is_cancelled && !$operation->is_terminal; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | 21 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | 28 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | 54 | ▶ | if ($callback->{on_informational}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | 0 | ▶ | $connection_callback{on_informational} = sub ($transaction, $response) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | 0 | $callback->{on_informational}->($transaction, $response); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | 0 | ▶ | $operation->_mark_cancelled | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$transaction->is_cancelled and not $operation->is_terminal
MC/DC0%0/2
$transaction->is_cancelled and not $operation->is_terminal
$transaction->is_cancelled
not $operation->is_terminal
Truth table0%0/3
A and not(B)
A= $transaction->is_cancelledB= not $operation->is_terminal
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | if $transaction->is_cancelled && !$operation->is_terminal; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | $connection_callback{stream_body} = $spec->{stream_body} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 808 | 54 | ▶ | if $spec->{has_stream_body}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 809 | $connection_callback{buffer_body} = $spec->{buffer_body} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 810 | 54 | ▶ | if $spec->{has_buffer_body}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 811 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 812 | 54 | ▶ | if ($allow_http2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$allow_http2 and $connection->can("_http2_capable") and $connection->_http2_capable
$allow_http2 and $connection->can("_http2_capable")
MC/DC0%0/3
$allow_http2 and $connection->can("_http2_capable") and $connection->_http2_capable
$allow_http2
$connection->can("_http2_capable")
$connection->_http2_capable
Truth table25%1/4
A and B and C
A= $allow_http2B= $connection->can("_http2_capable")C= $connection->_http2_capable
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 813 | && $connection->can('_http2_capable') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 814 | && $connection->_http2_capable) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 815 | 0 | ▶ | $connection_callback{_http1_reassign} = sub ($replacement) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 816 | 0 | $connection = $replacement; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 817 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 818 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 819 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 820 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 821 | 54 | ▶ | if (defined $spec->{upgrade_to}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 822 | 2 | $connection_callback{upgrade_to} = $spec->{upgrade_to}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 823 | 1 | ▶ | $connection_callback{on_upgrade} = sub ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 824 | $transaction, $response, $upgraded_connection, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 825 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 826 | 1 | $upgraded = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 827 | 1 | ▶ | $operation->_mark_complete if !$operation->is_terminal; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 828 | $callback->{on_upgrade}->( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 829 | $operation, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 830 | $transaction, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 831 | $response, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 832 | $upgraded_connection, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 833 | 1 | ▶ | ) if $callback->{on_upgrade}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 834 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 835 | 2 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 836 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 837 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 838 | 49 | ▶ | $connection_callback{on_complete} = sub ($transaction) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=21 SCAR=35.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 839 | 49 | ▶ | if ($upgraded) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 840 | $callback->{on_complete}->($transaction) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 841 | 1 | ▶ | if $callback->{on_complete}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 842 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 843 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 844 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 845 | 48 | $self->_release_connection($route->{origin}, $connection); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 846 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 847 | 48 | ▶ | if ($auth_retry) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 848 | 4 | ▶ | if (defined $auth_retry->{error}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 849 | 1 | my $error = $auth_retry->{error}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 850 | 1 | ▶ | $operation->_fail($error) if !$operation->is_terminal; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 851 | $callback->{on_error}->($transaction, $error) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 852 | 1 | ▶ | if $callback->{on_error}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 853 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 854 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 855 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 856 | 3 | my $ok = eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 857 | 3 | $self->_start_operation_hop($operation, $auth_retry->{spec}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 858 | 3 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 859 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 860 | 3 | ▶ | if (!$ok) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 861 | 0 | my $error = "$@"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 862 | 0 | $error =~ s/\s+\z//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 863 | 0 | ▶ | $operation->_fail($error) if !$operation->is_terminal; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 864 | $callback->{on_error}->($transaction, $error) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 865 | 0 | ▶ | if $callback->{on_error}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 866 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 867 | 3 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 868 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 869 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 870 | 44 | ▶ | if ($redirect) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 871 | 12 | ▶ | if (defined $redirect->{error}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 872 | 2 | my $error = $redirect->{error}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 873 | 2 | ▶ | $operation->_fail($error) if !$operation->is_terminal; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 874 | $callback->{on_error}->($transaction, $error) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 875 | 2 | ▶ | if $callback->{on_error}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 876 | 2 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 877 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 878 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 879 | 10 | ▶ | if (my $on_redirect = $callback->{on_redirect}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 880 | $on_redirect->( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 881 | $operation, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 882 | $transaction, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 883 | $transaction->response, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 884 | $redirect->{url}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 885 | 3 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 886 | 3 | ▶ | return if $operation->is_terminal; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 887 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 888 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 889 | 10 | my $ok = eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 890 | 10 | $self->_start_operation_hop($operation, $redirect->{spec}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 891 | 10 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 892 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 893 | 10 | ▶ | if (!$ok) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 894 | 0 | my $error = "$@"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 895 | 0 | $error =~ s/\s+\z//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 896 | 0 | ▶ | $operation->_fail($error) if !$operation->is_terminal; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 897 | $callback->{on_error}->($transaction, $error) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 898 | 0 | ▶ | if $callback->{on_error}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 899 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 900 | 10 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 901 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 902 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 903 | 32 | ▶ | $operation->_mark_complete if !$operation->is_terminal; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 904 | $callback->{on_complete}->($transaction) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 905 | 32 | ▶ | if $callback->{on_complete}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 906 | 32 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 907 | 54 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 908 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 909 | 2 | ▶ | $connection_callback{on_error} = sub ($transaction, $error) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 910 | 2 | ▶ | $operation->_fail($error) if !$operation->is_terminal; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 911 | $callback->{on_error}->($transaction, $error) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 912 | 2 | ▶ | if $callback->{on_error}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 913 | 2 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 914 | 54 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 915 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 916 | 54 | my $transaction; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 917 | 54 | my $ok = eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 918 | 54 | $transaction = $connection->request($message, %connection_callback); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 919 | 53 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 920 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 921 | 54 | ▶ | if (!$ok) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 922 | 1 | my $error = $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 923 | $self->_release_connection( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 924 | 1 | ▶ | $route->{origin}, $connection, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$connection->is_closed or defined $connection->transaction
MC/DC0%0/2
$connection->is_closed or defined $connection->transaction
$connection->is_closed
defined $connection->transaction
Truth table33%1/3
A or B
A= $connection->is_closedB= defined $connection->transaction
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 925 | ) if !$connection->is_closed && !defined($connection->transaction); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 926 | 1 | die $error; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 927 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 928 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 929 | $operation->_append_transaction( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 930 | 53 | ▶ | $transaction, $spec->{url}, $spec->{hop_kind} // 'initial', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$spec->{"hop_kind"} // "initial"
MC/DC0%0/1
$spec->{"hop_kind"} // "initial"
$spec->{"hop_kind"}
Truth table50%1/2
A
A= $spec->{"hop_kind"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 931 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 932 | 53 | return $transaction; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 933 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 934 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 935 | 55 | ▶ | sub request ($self, $method, $url, %option) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
request: called CC=48 SCAR=41.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 936 | 55 | ▶ | croak 'request(): Client is closed' if $self->{closed}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 937 | 54 | ▶ | croak 'request(): method is required' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
not defined $method or ref $method or $method eq ""
not defined $method or ref $method
MC/DC0%0/3
not defined $method or ref $method or $method eq ""
not defined $method
ref $method
$method eq ""
Truth table25%1/4
not(A) or B or C
A= not defined $methodB= ref $methodC= $method eq ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 938 | if !defined($method) || ref($method) || $method eq ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 939 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 940 | 54 | _parse_url($url); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 941 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 942 | my $proxy_url = exists($option{proxy}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 943 | ? delete($option{proxy}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 944 | 51 | ▶ | : $self->{proxy_url}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 945 | 51 | ▶ | _parse_proxy_url($proxy_url) if defined $proxy_url; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 946 | 49 | ▶ | croak 'request(): proxy cannot be used with CONNECT; use connect_tunnel()' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $proxy_url and uc $method eq "CONNECT"
MC/DC100%2/2
defined $proxy_url and uc $method eq "CONNECT"
defined $proxy_url
uc $method eq "CONNECT"
Truth table100%3/3
A and B
A= defined $proxy_urlB= uc $method eq "CONNECT"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 947 | if defined($proxy_url) && uc($method) eq 'CONNECT'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 948 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 949 | 47 | ▶ | my $auth = exists($option{auth}) ? delete($option{auth}) : $self->{auth}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 950 | my $proxy_auth = exists($option{proxy_auth}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 951 | ? delete($option{proxy_auth}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 952 | 47 | ▶ | : $self->{proxy_auth}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 953 | 47 | Linux::Event::HTTP::_ClientAuth::validate_manager( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 954 | $auth, 'request()', 'auth', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 955 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 956 | 47 | Linux::Event::HTTP::_ClientAuth::validate_manager( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 957 | $proxy_auth, 'request()', 'proxy_auth', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 958 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 959 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 960 | 47 | my $headers = _copy_headers(delete $option{headers}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 961 | 47 | for my $pair (@$headers) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 962 | 22 | ▶ | next if !defined($pair->[0]) || ref($pair->[0]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not defined $pair->[0] or ref $pair->[0]
MC/DC0%0/2
not defined $pair->[0] or ref $pair->[0]
not defined $pair->[0]
ref $pair->[0]
Truth table33%1/3
not(A) or B
A= not defined $pair->[0]B= ref $pair->[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 963 | 22 | my $name = lc($pair->[0]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 964 | croak 'request(): Cookie header is managed by cookie_jar; add cookies to the jar instead' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 965 | 22 | ▶ | if $self->{cookie_jar} && $name eq 'cookie'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->{"cookie_jar"} and $name eq "cookie"
MC/DC50%1/2
$self->{"cookie_jar"} and $name eq "cookie"
$self->{"cookie_jar"}
$name eq "cookie"
Truth table66%2/3
A and B
A= $self->{"cookie_jar"}B= $name eq "cookie"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 966 | 21 | ▶ | croak 'request(): Authorization header is managed by auth' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$auth and $name eq "authorization"
MC/DC100%2/2
$auth and $name eq "authorization"
$auth
$name eq "authorization"
Truth table100%3/3
A and B
A= $authB= $name eq "authorization"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 967 | if $auth && $name eq 'authorization'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 968 | 20 | ▶ | croak 'request(): Proxy-Authorization header is managed by proxy_auth' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$proxy_auth and $name eq "proxy-authorization"
MC/DC0%0/2
$proxy_auth and $name eq "proxy-authorization"
$proxy_auth
$name eq "proxy-authorization"
Truth table33%1/3
A and B
A= $proxy_authB= $name eq "proxy-authorization"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 969 | if $proxy_auth && $name eq 'proxy-authorization'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 970 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 971 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 972 | 45 | my $version_explicit = exists $option{version}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 973 | 45 | ▶ | my $version = delete($option{version}) // '1.1'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
delete $option{"version"} // "1.1"
MC/DC100%1/1
delete $option{"version"} // "1.1"
delete $option{"version"}
Truth table100%2/2
A
A= delete $option{"version"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 974 | 45 | my $has_body = exists $option{body}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 975 | 45 | my $body = delete $option{body}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 976 | 45 | my $has_stream_body = exists $option{stream_body}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 977 | my $stream_body = $has_stream_body | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 978 | ? _validate_stream_body(delete $option{stream_body}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 979 | 45 | ▶ | : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 980 | 44 | my $has_buffer_body = exists $option{buffer_body}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 981 | my $buffer_body = $has_buffer_body | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 982 | ? _validate_buffer_body(delete $option{buffer_body}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 983 | 44 | ▶ | : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 984 | my $upgrade_to = exists($option{upgrade_to}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 985 | ? delete($option{upgrade_to}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 986 | 43 | ▶ | : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 987 | my $max_redirects = _validate_max_redirects( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 988 | exists($option{max_redirects}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 989 | ? delete($option{max_redirects}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 990 | : $self->{max_redirects}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 991 | 43 | ▶ | 'request()', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 992 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 993 | my $max_auth_retries = _validate_max_auth_retries( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 994 | exists($option{max_auth_retries}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 995 | ? delete($option{max_auth_retries}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 996 | : $self->{max_auth_retries}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 997 | 43 | ▶ | 'request()', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 998 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 999 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1000 | 43 | ▶ | croak 'request(): body and stream_body are mutually exclusive' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$has_body and $has_stream_body
MC/DC100%2/2
$has_body and $has_stream_body
$has_body
$has_stream_body
Truth table100%3/3
A and B
A= $has_bodyB= $has_stream_body
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1001 | if $has_body && $has_stream_body; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1002 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1003 | 42 | my %callback; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1004 | 42 | for my $name (keys %CALLBACK) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1005 | 336 | ▶ | next if !exists $option{$name}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1006 | 114 | my $value = delete $option{$name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1007 | 114 | ▶ | croak "request(): $name must be a coderef" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $value and ref $value ne "CODE"
MC/DC0%0/2
defined $value and ref $value ne "CODE"
defined $value
ref $value ne "CODE"
Truth table33%1/3
A and B
A= defined $valueB= ref $value ne "CODE"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1008 | if defined($value) && ref($value) ne 'CODE'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1009 | 114 | ▶ | $callback{$name} = $value if defined $value; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1010 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1011 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1012 | croak 'request(): buffer_body cannot be combined with on_body' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1013 | 42 | ▶ | if $has_buffer_body && $callback{on_body}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$has_buffer_body and $callback{"on_body"}
MC/DC100%2/2
$has_buffer_body and $callback{"on_body"}
$has_buffer_body
$callback{"on_body"}
Truth table100%3/3
A and B
A= $has_buffer_bodyB= $callback{"on_body"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1014 | croak 'request(): on_upgrade requires upgrade_to' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1015 | 41 | ▶ | if $callback{on_upgrade} && !defined($upgrade_to); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$callback{"on_upgrade"} and not defined $upgrade_to
MC/DC0%0/2
$callback{"on_upgrade"} and not defined $upgrade_to
$callback{"on_upgrade"}
not defined $upgrade_to
Truth table66%2/3
A and not(B)
A= $callback{"on_upgrade"}B= not defined $upgrade_to
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1016 | 41 | ▶ | croak 'request(): upgrade_to cannot be combined with buffer_body' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $upgrade_to and $has_buffer_body
MC/DC0%0/2
defined $upgrade_to and $has_buffer_body
defined $upgrade_to
$has_buffer_body
Truth table66%2/3
A and B
A= defined $upgrade_toB= $has_buffer_body
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1017 | if defined($upgrade_to) && $has_buffer_body; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1018 | croak 'request(): upgrade_to cannot be combined with on_body' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1019 | 41 | ▶ | if defined($upgrade_to) && $callback{on_body}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $upgrade_to and $callback{"on_body"}
MC/DC0%0/2
defined $upgrade_to and $callback{"on_body"}
defined $upgrade_to
$callback{"on_body"}
Truth table66%2/3
A and B
A= defined $upgrade_toB= $callback{"on_body"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1020 | croak 'request(): on_tunnel is only valid with connect_tunnel()' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1021 | 41 | ▶ | if $callback{on_tunnel}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1022 | 41 | ▶ | croak 'request(): unknown options: ' . join(', ', sort keys %option) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1023 | if %option; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1024 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1025 | 41 | my $operation = Linux::Event::HTTP::Client::Operation->_new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1026 | initial_url => "$url", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1027 | max_redirects => $max_redirects, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1028 | max_auth_retries => $max_auth_retries, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1029 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1030 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1031 | 41 | ▶ | my $spec = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 5 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1032 | url => "$url", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1033 | proxy_url => defined($proxy_url) ? "$proxy_url" : undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1034 | method => $method, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1035 | headers => $headers, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1036 | version => $version, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1037 | version_explicit => $version_explicit ? 1 : 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1038 | has_body => $has_body ? 1 : 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1039 | body => $body, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1040 | has_stream_body => $has_stream_body ? 1 : 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1041 | stream_body => $stream_body, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1042 | has_buffer_body => $has_buffer_body ? 1 : 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1043 | buffer_body => $buffer_body, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1044 | max_redirects => $max_redirects, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1045 | max_auth_retries => $max_auth_retries, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1046 | auth => $auth, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1047 | proxy_auth => $proxy_auth, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1048 | authorization => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1049 | proxy_authorization => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1050 | upgrade_to => $upgrade_to, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1051 | callback => \%callback, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1052 | hop_kind => 'initial', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1053 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1054 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1055 | 41 | $self->_start_operation_hop($operation, $spec); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1056 | 40 | return $operation; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1057 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1058 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1059 | 4 | ▶ | sub _start_connect_tunnel_attempt ($self, $operation, $spec) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_start_connect_tunnel_attempt: called CC=10 SCAR=29.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1060 | 4 | ▶ | die 'cannot start another CONNECT attempt for a terminal Client operation' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1061 | if $operation->is_terminal; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1062 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1063 | my $destination = _parse_proxy_url( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1064 | 4 | $spec->{proxy_url}, 'connect_tunnel()', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1065 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1066 | 4 | my $headers = _copy_headers($spec->{headers}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1067 | push @$headers, [ 'Proxy-Authorization' => $spec->{proxy_authorization} ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1068 | 4 | ▶ | if defined $spec->{proxy_authorization}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1069 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1070 | my $message = Linux::Event::HTTP::Request->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1071 | method => 'CONNECT', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1072 | target => $spec->{target_authority}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1073 | 4 | version => '1.1', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1074 | headers => $headers, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1075 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1076 | 4 | my $connection = $self->_connection_for($destination, 0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1077 | 4 | my $callback = $spec->{callback}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1078 | 4 | my ($auth_retry, $tunneled); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1079 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1080 | 4 | my %connection_callback = (tunnel_to => $spec->{tunnel_to}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1081 | $connection_callback{buffer_body} = $spec->{buffer_body} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1082 | 4 | ▶ | if $spec->{has_buffer_body}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1083 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1084 | 4 | ▶ | $connection_callback{on_response} = sub ($transaction, $response) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=11 SCAR=25.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1085 | 4 | ▶ | if ($response->status == 407 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition77%7/9
$response->status == 407 and $spec->{"proxy_auth"} and $spec->{"max_auth_retries"} > 0 and $operation->auth_retry_count < $spec->{"max_auth_retries"}
$response->status == 407 and $spec->{"proxy_auth"} and $spec->{"max_auth_retries"} > 0
$response->status == 407 and $spec->{"proxy_auth"}
MC/DC50%2/4
$response->status == 407 and $spec->{"proxy_auth"} and $spec->{"max_auth_retries"} > 0 and $operation->auth_retry_count < $spec->{"max_auth_retries"}
$response->status == 407
$spec->{"proxy_auth"}
$spec->{"max_auth_retries"} > 0
$operation->auth_retry_count < $spec->{"max_auth_retries"}
Truth table60%3/5
A and B and C and D
A= $response->status == 407B= $spec->{"proxy_auth"}C= $spec->{"max_auth_retries"} > 0D= $operation->auth_retry_count < $spec->{"max_auth_retries"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1086 | && $spec->{proxy_auth} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1087 | && $spec->{max_auth_retries} > 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1088 | && $operation->auth_retry_count < $spec->{max_auth_retries}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1089 | my $prepared = Linux::Event::HTTP::_ClientAuth::prepare_retry( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1090 | manager => $spec->{proxy_auth}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1091 | response => $response, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1092 | challenge_header => 'Proxy-Authenticate', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1093 | origin => $destination->{auth_origin}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1094 | 1 | request => $message, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1095 | status => 407, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1096 | label => 'proxy', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1097 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1098 | 1 | ▶ | if ($prepared) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1099 | 1 | ▶ | if (defined $prepared->{error}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1100 | 0 | $auth_retry = $prepared; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1101 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1102 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1103 | 1 | my %next = %$spec; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1104 | 1 | $next{proxy_authorization} = $prepared->{value}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1105 | 1 | $next{hop_kind} = 'auth'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1106 | 1 | $auth_retry = { spec => \%next, scheme => $prepared->{scheme} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1107 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1108 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1109 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1110 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1111 | 4 | ▶ | if (!$auth_retry && $callback->{on_response}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not $auth_retry and $callback->{"on_response"}
MC/DC100%2/2
not $auth_retry and $callback->{"on_response"}
not $auth_retry
$callback->{"on_response"}
Truth table100%3/3
not(A) and B
A= not $auth_retryB= $callback->{"on_response"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1112 | 2 | $callback->{on_response}->($transaction, $response); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1113 | 2 | ▶ | $operation->_mark_cancelled | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$transaction->is_cancelled and not $operation->is_terminal
MC/DC0%0/2
$transaction->is_cancelled and not $operation->is_terminal
$transaction->is_cancelled
not $operation->is_terminal
Truth table33%1/3
A and not(B)
A= $transaction->is_cancelledB= not $operation->is_terminal
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1114 | if $transaction->is_cancelled && !$operation->is_terminal; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1115 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1116 | 4 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1117 | 4 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1118 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1119 | 4 | ▶ | if ($callback->{on_body}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1120 | 0 | ▶ | $connection_callback{on_body} = sub ($transaction, $response, $bytes) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1121 | 0 | ▶ | return if $auth_retry; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1122 | 0 | $callback->{on_body}->($transaction, $response, $bytes); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1123 | 0 | ▶ | $operation->_mark_cancelled | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$transaction->is_cancelled and not $operation->is_terminal
MC/DC0%0/2
$transaction->is_cancelled and not $operation->is_terminal
$transaction->is_cancelled
not $operation->is_terminal
Truth table0%0/3
A and not(B)
A= $transaction->is_cancelledB= not $operation->is_terminal
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1124 | if $transaction->is_cancelled && !$operation->is_terminal; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1125 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1126 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1127 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1128 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1129 | 4 | ▶ | if ($callback->{on_informational}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1130 | 0 | ▶ | $connection_callback{on_informational} = sub ($transaction, $response) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1131 | 0 | $callback->{on_informational}->($transaction, $response); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1132 | 0 | ▶ | $operation->_mark_cancelled | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$transaction->is_cancelled and not $operation->is_terminal
MC/DC0%0/2
$transaction->is_cancelled and not $operation->is_terminal
$transaction->is_cancelled
not $operation->is_terminal
Truth table0%0/3
A and not(B)
A= $transaction->is_cancelledB= not $operation->is_terminal
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1133 | if $transaction->is_cancelled && !$operation->is_terminal; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1134 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1135 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1136 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1137 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1138 | 2 | ▶ | $connection_callback{on_tunnel} = sub ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1139 | $transaction, $response, $tunnel_connection, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1140 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1141 | 2 | $tunneled = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1142 | 2 | ▶ | $operation->_mark_complete if !$operation->is_terminal; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1143 | $callback->{on_tunnel}->( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1144 | $operation, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1145 | $transaction, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1146 | $response, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1147 | $tunnel_connection, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1148 | 2 | ▶ | ) if $callback->{on_tunnel}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1149 | 2 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1150 | 4 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1151 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1152 | 4 | ▶ | $connection_callback{on_complete} = sub ($transaction) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=12 SCAR=33.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1153 | 4 | ▶ | if ($tunneled) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1154 | $callback->{on_complete}->($transaction) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1155 | 2 | ▶ | if $callback->{on_complete}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1156 | 2 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1157 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1158 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1159 | 2 | $self->_release_connection($destination->{origin}, $connection); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1160 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1161 | 2 | ▶ | if ($auth_retry) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1162 | 1 | ▶ | if (defined $auth_retry->{error}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1163 | 0 | my $error = $auth_retry->{error}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1164 | 0 | ▶ | $operation->_fail($error) if !$operation->is_terminal; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1165 | $callback->{on_error}->($transaction, $error) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1166 | 0 | ▶ | if $callback->{on_error}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1167 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1168 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1169 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1170 | 1 | my $ok = eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1171 | $self->_start_connect_tunnel_attempt( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1172 | $operation, $auth_retry->{spec}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1173 | 1 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1174 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1175 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1176 | 1 | ▶ | if (!$ok) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1177 | 0 | my $error = "$@"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1178 | 0 | $error =~ s/\s+\z//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1179 | 0 | ▶ | $operation->_fail($error) if !$operation->is_terminal; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1180 | $callback->{on_error}->($transaction, $error) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1181 | 0 | ▶ | if $callback->{on_error}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1182 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1183 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1184 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1185 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1186 | 1 | ▶ | $operation->_mark_complete if !$operation->is_terminal; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1187 | $callback->{on_complete}->($transaction) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1188 | 1 | ▶ | if $callback->{on_complete}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1189 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1190 | 4 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1191 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1192 | 0 | ▶ | $connection_callback{on_error} = sub ($transaction, $error) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1193 | 0 | ▶ | $operation->_fail($error) if !$operation->is_terminal; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1194 | $callback->{on_error}->($transaction, $error) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1195 | 0 | ▶ | if $callback->{on_error}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1196 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1197 | 4 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1198 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1199 | 4 | my $transaction; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1200 | 4 | my $ok = eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1201 | 4 | $transaction = $connection->request($message, %connection_callback); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1202 | 4 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1203 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1204 | 4 | ▶ | if (!$ok) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1205 | 0 | my $error = $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1206 | $self->_release_connection( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1207 | 0 | ▶ | $destination->{origin}, $connection, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$connection->is_closed or defined $connection->transaction
MC/DC0%0/2
$connection->is_closed or defined $connection->transaction
$connection->is_closed
defined $connection->transaction
Truth table0%0/3
A or B
A= $connection->is_closedB= defined $connection->transaction
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1208 | ) if !$connection->is_closed && !defined($connection->transaction); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1209 | 0 | die $error; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1210 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1211 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1212 | $operation->_append_transaction( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1213 | $transaction, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1214 | $spec->{proxy_url}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1215 | 4 | ▶ | $spec->{hop_kind} // 'initial', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$spec->{"hop_kind"} // "initial"
MC/DC0%0/1
$spec->{"hop_kind"} // "initial"
$spec->{"hop_kind"}
Truth table50%1/2
A
A= $spec->{"hop_kind"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1216 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1217 | 4 | return $transaction; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1218 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1219 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1220 | 3 | ▶ | sub connect_tunnel ($self, $proxy_url, $target_authority, %option) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
connect_tunnel: called CC=26 SCAR=39.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1221 | 3 | ▶ | croak 'connect_tunnel(): Client is closed' if $self->{closed}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1222 | 3 | ▶ | croak 'connect_tunnel(): target authority is required' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
not defined $target_authority or ref $target_authority or $target_authority eq ""
not defined $target_authority or ref $target_authority
MC/DC0%0/3
not defined $target_authority or ref $target_authority or $target_authority eq ""
not defined $target_authority
ref $target_authority
$target_authority eq ""
Truth table25%1/4
not(A) or B or C
A= not defined $target_authorityB= ref $target_authorityC= $target_authority eq ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1223 | if !defined($target_authority) || ref($target_authority) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1224 | || $target_authority eq ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1225 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1226 | 3 | _parse_proxy_url($proxy_url, 'connect_tunnel()'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1227 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1228 | my $proxy_auth = exists($option{proxy_auth}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1229 | ? delete($option{proxy_auth}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1230 | 3 | ▶ | : $self->{proxy_auth}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1231 | 3 | Linux::Event::HTTP::_ClientAuth::validate_manager( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1232 | $proxy_auth, 'connect_tunnel()', 'proxy_auth', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1233 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1234 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1235 | 3 | my $headers = _copy_headers(delete $option{headers}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1236 | 3 | for my $pair (@$headers) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1237 | 1 | ▶ | next if !defined($pair->[0]) || ref($pair->[0]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not defined $pair->[0] or ref $pair->[0]
MC/DC0%0/2
not defined $pair->[0] or ref $pair->[0]
not defined $pair->[0]
ref $pair->[0]
Truth table33%1/3
not(A) or B
A= not defined $pair->[0]B= ref $pair->[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1238 | 1 | ▶ | croak 'connect_tunnel(): Proxy-Authorization header is managed by proxy_auth' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$proxy_auth and lc $pair->[0] eq "proxy-authorization"
MC/DC0%0/2
$proxy_auth and lc $pair->[0] eq "proxy-authorization"
$proxy_auth
lc $pair->[0] eq "proxy-authorization"
Truth table33%1/3
A and B
A= $proxy_authB= lc $pair->[0] eq "proxy-authorization"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1239 | if $proxy_auth && lc($pair->[0]) eq 'proxy-authorization'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1240 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1241 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1242 | my @host = grep { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1243 | 3 | ▶ | defined($_->[0]) && !ref($_->[0]) && lc($_->[0]) eq 'host' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%2/6
defined $_->[0] && !ref($_->[0]) && lc $_->[0] eq 'host'
defined $_->[0] and not ref $_->[0]
MC/DC0%0/3
defined $_->[0] && !ref($_->[0]) && lc $_->[0] eq 'host'
defined $_->[0]
not ref $_->[0]
lc $_->[0] eq 'host'
Truth table25%1/4
A and not(B) && C
A= defined $_->[0]B= not ref $_->[0]C= lc $_->[0] eq 'host'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1244 | } @$headers; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1245 | 3 | ▶ | push @$headers, [ Host => "$target_authority" ] if !@host; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1246 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1247 | my $tunnel_to = delete($option{tunnel_to}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1248 | 3 | ▶ | // croak 'connect_tunnel(): tunnel_to is required'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
delete $option{"tunnel_to"} // croak("connect_tunnel(): tunnel_to is required")
MC/DC0%0/2
delete $option{"tunnel_to"} // croak("connect_tunnel(): tunnel_to is required")
delete $option{"tunnel_to"}
croak("connect_tunnel(): tunnel_to is required")
Truth table33%1/3
A // B
A= delete $option{"tunnel_to"}B= croak("connect_tunnel(): tunnel_to is required")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1249 | 3 | my $has_buffer_body = exists $option{buffer_body}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1250 | my $buffer_body = $has_buffer_body | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1251 | ? _validate_buffer_body(delete $option{buffer_body}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1252 | 3 | ▶ | : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1253 | my $max_auth_retries = _validate_max_auth_retries( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1254 | exists($option{max_auth_retries}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1255 | ? delete($option{max_auth_retries}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1256 | : $self->{max_auth_retries}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1257 | 3 | ▶ | 'connect_tunnel()', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1258 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1259 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1260 | 3 | my %callback; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1261 | 3 | my %known_callback = map { $_ => 1 } qw( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1262 | on_response on_body on_complete on_error on_informational on_tunnel | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1263 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1264 | 3 | for my $name (keys %known_callback) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1265 | 18 | ▶ | next if !exists $option{$name}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1266 | 11 | my $value = delete $option{$name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1267 | 11 | ▶ | croak "connect_tunnel(): $name must be a coderef" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $value and ref $value ne "CODE"
MC/DC0%0/2
defined $value and ref $value ne "CODE"
defined $value
ref $value ne "CODE"
Truth table33%1/3
A and B
A= defined $valueB= ref $value ne "CODE"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1268 | if defined($value) && ref($value) ne 'CODE'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1269 | 11 | ▶ | $callback{$name} = $value if defined $value; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1270 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1271 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1272 | croak 'connect_tunnel(): buffer_body cannot be combined with on_body' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1273 | 3 | ▶ | if $has_buffer_body && $callback{on_body}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$has_buffer_body and $callback{"on_body"}
MC/DC0%0/2
$has_buffer_body and $callback{"on_body"}
$has_buffer_body
$callback{"on_body"}
Truth table66%2/3
A and B
A= $has_buffer_bodyB= $callback{"on_body"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1274 | 3 | ▶ | croak 'connect_tunnel(): unknown options: ' . join(', ', sort keys %option) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1275 | if %option; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1276 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1277 | 3 | my $operation = Linux::Event::HTTP::Client::Operation->_new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1278 | initial_url => "$proxy_url", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1279 | max_redirects => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1280 | max_auth_retries => $max_auth_retries, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1281 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1282 | 3 | ▶ | my $spec = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1283 | proxy_url => "$proxy_url", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1284 | target_authority => "$target_authority", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1285 | headers => $headers, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1286 | tunnel_to => $tunnel_to, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1287 | has_buffer_body => $has_buffer_body ? 1 : 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1288 | buffer_body => $buffer_body, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1289 | proxy_auth => $proxy_auth, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1290 | proxy_authorization => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1291 | max_auth_retries => $max_auth_retries, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1292 | callback => \%callback, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1293 | hop_kind => 'initial', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1294 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1295 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1296 | 3 | $self->_start_connect_tunnel_attempt($operation, $spec); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1297 | 3 | return $operation; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1298 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1299 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1300 | 37 | ▶ | sub get ($self, $url, %option) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1301 | 37 | return $self->request('GET', $url, %option); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1302 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1303 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1304 | 1 | ▶ | sub head ($self, $url, %option) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
head: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1305 | 1 | return $self->request('HEAD', $url, %option); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1306 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1307 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1308 | 14 | ▶ | sub post ($self, $url, %option) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
post: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1309 | 14 | return $self->request('POST', $url, %option); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1310 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1311 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1312 | 0 | ▶ | sub put ($self, $url, %option) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
put: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1313 | 0 | return $self->request('PUT', $url, %option); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1314 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1315 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1316 | 1 | ▶ | sub delete ($self, $url, %option) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
delete: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1317 | 1 | return $self->request('DELETE', $url, %option); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1318 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1319 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1320 | 18 | ▶ | sub close ($self) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
close: called CC=6 SCAR=18.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1321 | 18 | ▶ | return $self if $self->{closed}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1322 | 18 | $self->{closed} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1323 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1324 | 18 | my %closed; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1325 | 18 | my @h2 = map { @$_ } values %{$self->{h2_pool}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1326 | 18 | my @negotiating = map { @$_ } values %{$self->{h2_negotiating}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1327 | 18 | for my $connection ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1328 | 18 | values %{$self->{idle}}, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1329 | @h2, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1330 | @negotiating, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1331 | 18 | values %{$self->{connections}}, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1332 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1333 | 51 | ▶ | next if !$connection; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1334 | 47 | my $id = refaddr($connection); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1335 | 47 | ▶ | next if $closed{$id}++; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1336 | 31 | ▶ | $connection->close if !$connection->is_closed; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1337 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1338 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1339 | 18 | $self->{idle} = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1340 | 18 | $self->{h2_pool} = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1341 | 18 | $self->{h2_negotiating} = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1342 | 18 | $self->{connections} = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1343 | 18 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1344 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1345 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1346 | 14 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1347 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1348 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||