| 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
| |||||||||||||||||||||||||||||
| 11 | 13 | ▶ | die "$where: $name must be a Uniform::HTTP::Auth object" | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
builtin::blessed($value) and $value->isa("Uniform::HTTP::Auth")
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")
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 18 | 5 | my $challenge = $arg{response}->header_values($arg{challenge_header}); | |||||||||||||||||||||||||||
| 19 | 5 | ▶ | return undef if !@$challenge; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
Condition66%2/3
$request->has_buffered_body or $request->_has_incremental_body
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
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | 5 | ▶ | if ($request->_has_incremental_body) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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; | |||||||||||||||||||||||||||