HTTP/_ClientAuth.pm

filter: Statementstmt 91.8% 34 / 37 Branchbran 68.7% 11 / 16 Conditioncond 50.0% 3 / 6 MC/DCmcdc 25.0% 1 / 4 Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 2 totaltotal 77.7% 56 / 72 CC 11 SCAR 17.0
CC
11
Cov
81%
prepare_retry
8.8
validate_manager
4.4
BEGIN
1.0
CRAP 5.5
« HTTP/_HTTP2/ClientSelectorConnection.pm ↑ Summary HTTP/Response.pm »
1 package Linux::Event::HTTP::_ClientAuth;
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 Scalar::Util qw(blessed);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 14 ▶use Uniform::HTTP::Auth 0.02 ();
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 133 ▶sub validate_manager ($value, $where, $name) {
Subroutine validate_manager: called CC=4 SCAR=14.9
Pod undocumented
10 133 ▶ return undef if !defined $value;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $value 120 13 133
11 13 ▶ die "$where: $name must be a Uniform::HTTP::Auth object"
Branch: 1 branch
BranchTrueFalseTotal
unless builtin::blessed($value) and $value->isa("Uniform::HTTP::Auth") 0 13 13
Condition33%1/3
builtin::blessed($value) and $value->isa("Uniform::HTTP::Auth")
!ll&&!rl&&r
0013
MC/DC0%0/2
builtin::blessed($value) and $value->isa("Uniform::HTTP::Auth")
builtin::blessed($value) $value->isa("Uniform::HTTP::Auth")
Truth table33%1/3
A and B
A= builtin::blessed($value)B= $value->isa("Uniform::HTTP::Auth")
ABresult
0X0
100
111
12 if !blessed($value) || !$value->isa('Uniform::HTTP::Auth');
13 13 return $value;
14 }
15  
16 5 ▶sub prepare_retry (%arg) {
Subroutine prepare_retry: called CC=8 SCAR=21.8
Pod undocumented
17 5 ▶ my $manager = $arg{manager} or return undef;
Branch: 1 branch
BranchTrueFalseTotal
my $manager = $arg{"manager"} or return undef 5 0 5
18 5 my $challenge = $arg{response}->header_values($arg{challenge_header});
19 5 ▶ return undef if !@$challenge;
Branch: 1 branch
BranchTrueFalseTotal
unless @$challenge 0 5 5
20  
21 5 my $request = $arg{request};
22 my %prepare = (
23 challenge_headers => $challenge,
24 origin => $arg{origin},
25 5 request => $request,
26 );
27  
28 # Uniform can read a complete buffered scalar body from the Request itself.
29 # A locally constructed bodyless Request has no body buffer, but its Digest
30 # auth-int entity is still the known empty byte string. Streaming producers
31 # remain deliberately unconsumed and non-replayable.
32 5 ▶ if (!$request->has_buffered_body && !$request->_has_incremental_body) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($request->has_buffered_body or $request->_has_incremental_body) 4 1 5
Condition66%2/3
$request->has_buffered_body or $request->_has_incremental_body
l!l&&r!l&&!r
014
MC/DC50%1/2
$request->has_buffered_body or $request->_has_incremental_body
$request->has_buffered_body $request->_has_incremental_body
Truth table66%2/3
A or B
A= $request->has_buffered_bodyB= $request->_has_incremental_body
ABresult
1X1
011
000
33 4 $prepare{entity_body} = '';
34 }
35  
36 5 my $result;
37 5 my $ok = eval {
38 5 $result = $manager->prepare_authentication(%prepare);
39 5 1;
40 };
41 5 ▶ if (!$ok) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($ok) 0 5 5
42 0 my $error = "$@";
43 0 $error =~ s/\s+\z//;
44 return {
45 0 error => "$arg{label} authentication preparation failed: $error",
46 };
47 }
48  
49 5 ▶ return undef if !$result;
Branch: 1 branch
BranchTrueFalseTotal
unless $result 0 5 5
50  
51 5 ▶ if ($request->_has_incremental_body) {
Branch: 1 branch
BranchTrueFalseTotal
if ($request->_has_incremental_body) 1 4 5
52 return {
53 1 error => "cannot automatically retry $arg{status} $arg{label} authentication for a streaming Request body because the producer is not replayable",
54 };
55 }
56  
57 return {
58 scheme => $result->{scheme},
59 value => $result->{value},
60 4 };
61 }
62  
63 14 1;
« HTTP/_HTTP2/ClientSelectorConnection.pm ↑ Summary HTTP/Response.pm »