| 1 | package | ||||||||||||||||||||||||||||||||||||||
| 2 | Mojo::ATProto::OAuth::ResourceClient; | ||||||||||||||||||||||||||||||||||||||
| 3 | 7 | ▶ | use Mojo::Base -base, -signatures; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||
| 5 | 7 | ▶ | use Mojo::ATProto::OAuth::DPoP qw//; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 6 | 7 | ▶ | use Mojo::URL qw//; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 7 | 7 | ▶ | use Mojo::UserAgent qw//; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 8 | 7 | ▶ | use Mojo::Log qw//; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 9 | 7 | ▶ | use Mojo::Promise qw//; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||
| 11 | 7 | ▶ | use feature 'try'; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||
| 13 | 7 | ▶ | use constant DEBUG => $ENV{MOJO_OAUTH_DEBUG} || 0; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=2 SCAR=7.1
Condition50%1/2
$ENV{'MOJO_OAUTH_DEBUG'} || 0
MC/DC0%0/1
$ENV{'MOJO_OAUTH_DEBUG'} || 0
$ENV{'MOJO_OAUTH_DEBUG'}
Truth table50%1/2
A
A= $ENV{'MOJO_OAUTH_DEBUG'}
| |||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||
| 15 | 7 | our $VERSION = '1.03'; # VERSION | |||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||
| 17 | 0 | ▶ | has 'oauth' => sub { die "oauth is required\n" }; # Mojo::ATProto::OAuth instance - only ->store, ->refresh_tokens(_p) and ->_update_stored_session(_p) are used | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||
| 18 | 10 | ▶ | has 'ua' => sub($self) { $self->oauth->ua }; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 19 | 0 | ▶ | has 'log' => sub($self) { $self->oauth->log }; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||
| 21 | # Sends an authenticated XRPC request against $did's stored session's own | ||||||||||||||||||||||||||||||||||||||
| 22 | # PDS (host_url), handling DPoP nonce rotation and access-token refresh | ||||||||||||||||||||||||||||||||||||||
| 23 | # transparently. $method is a lowercase Mojo::UserAgent verb ('get', | ||||||||||||||||||||||||||||||||||||||
| 24 | # 'post', ...), $path is the XRPC path (and query string, if any) to | ||||||||||||||||||||||||||||||||||||||
| 25 | # append to host_url, $body (if given) is sent as a JSON request body. | ||||||||||||||||||||||||||||||||||||||
| 26 | # Returns the decoded JSON response. Dies on a non-2xx response that | ||||||||||||||||||||||||||||||||||||||
| 27 | # isn't recovered by a nonce/refresh retry - see _request_with_session. | ||||||||||||||||||||||||||||||||||||||
| 28 | 8 | ▶ | sub request($self, $did, $session_id, $method, $path, $body = undef) { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
request: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 29 | 8 | my $session = $self->oauth->store->get_session($did, $session_id); | |||||||||||||||||||||||||||||||||||||
| 30 | 8 | return $self->_request_with_session($session, $method, $path, $body, 1, 1); | |||||||||||||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||
| 33 | 4 | ▶ | sub request_p($self, $did, $session_id, $method, $path, $body = undef) { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
request_p: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 34 | 4 | ▶ | return $self->oauth->store->get_session_p($did, $session_id)->then(sub($session) { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 35 | 4 | return $self->_request_with_session_p($session, $method, $path, $body, 1, 1); | |||||||||||||||||||||||||||||||||||||
| 36 | 4 | }); | |||||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||
| 39 | # DPoP nonce rotation (RFC 9449): a 401 accompanied by a fresh | ||||||||||||||||||||||||||||||||||||||
| 40 | # DPoP-Nonce response header means "retry with this nonce", not a real | ||||||||||||||||||||||||||||||||||||||
| 41 | # auth failure - bounded by $nonce_retries_left. A 401 with no fresh | ||||||||||||||||||||||||||||||||||||||
| 42 | # nonce means the access token itself needs refreshing, via | ||||||||||||||||||||||||||||||||||||||
| 43 | # $self->oauth->refresh_tokens(_p) (which persists the refreshed session | ||||||||||||||||||||||||||||||||||||||
| 44 | # itself) - bounded by $refresh_retries_left. Either bound reaching 0 | ||||||||||||||||||||||||||||||||||||||
| 45 | # means a persistently-failing session dies cleanly instead of looping. | ||||||||||||||||||||||||||||||||||||||
| 46 | 11 | ▶ | sub _request_with_session($self, $session, $method, $path, $body, $nonce_retries_left, $refresh_retries_left) { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
_request_with_session: called CC=12 SCAR=24.9
| |||||||||||||||||||||||||||||||||||||||
| 47 | 11 | my $url = Mojo::URL->new($session->{host_url})->path($path); | |||||||||||||||||||||||||||||||||||||
| 48 | 11 | my $dpop_key = Mojo::ATProto::OAuth::DPoP->import_private_pem($session->{dpop_private_key_pem}); | |||||||||||||||||||||||||||||||||||||
| 49 | my $dpop_jwt = Mojo::ATProto::OAuth::DPoP->proof( | ||||||||||||||||||||||||||||||||||||||
| 50 | key => $dpop_key, method => $method, url => $url->to_string, | ||||||||||||||||||||||||||||||||||||||
| 51 | nonce => $session->{dpop_host_nonce}, access_token => $session->{access_token}, | ||||||||||||||||||||||||||||||||||||||
| 52 | issuer => $session->{auth_server_url}, | ||||||||||||||||||||||||||||||||||||||
| 53 | 11 | ); | |||||||||||||||||||||||||||||||||||||
| 54 | 11 | $self->log->debug("request: $method $url") if DEBUG; | |||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||
| 56 | 11 | my $headers = {Authorization => 'DPoP ' . $session->{access_token}, DPoP => $dpop_jwt}; | |||||||||||||||||||||||||||||||||||||
| 57 | 11 | ▶ | my @extra = defined($body) ? (json => $body) : (); | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 58 | 11 | my $tx = $self->ua->$method($url, $headers, @extra); | |||||||||||||||||||||||||||||||||||||
| 59 | 11 | my $res = $tx->res; | |||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||
| 61 | # The resource server can rotate the DPoP nonce on any response, not | ||||||||||||||||||||||||||||||||||||||
| 62 | # just a 401 - persist it either way so the next call anywhere starts | ||||||||||||||||||||||||||||||||||||||
| 63 | # from the freshest known nonce. Only the nonce is written: $session | ||||||||||||||||||||||||||||||||||||||
| 64 | # was read before this request, and writing all of it back would | ||||||||||||||||||||||||||||||||||||||
| 65 | # overwrite tokens another process may have refreshed since. | ||||||||||||||||||||||||||||||||||||||
| 66 | 11 | ▶ | my $new_nonce = $res->headers->header('DPoP-Nonce') // ''; | ||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$res->headers->header("DPoP-Nonce") // ""
MC/DC100%1/1
$res->headers->header("DPoP-Nonce") // ""
$res->headers->header("DPoP-Nonce")
Truth table100%2/2
A
A= $res->headers->header("DPoP-Nonce")
| |||||||||||||||||||||||||||||||||||||||
| 67 | 11 | ▶ | if (length($new_nonce) && $new_nonce ne ($session->{dpop_host_nonce} // '')) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition60%3/5
length $new_nonce and $new_nonce ne ($session->{"dpop_host_nonce"} // "")
$session->{"dpop_host_nonce"} // ""
MC/DC50%1/2
length $new_nonce and $new_nonce ne ($session->{"dpop_host_nonce"} // "")
length $new_nonce
$new_nonce ne ($session->{"dpop_host_nonce"} // "")
MC/DC0%0/1
$session->{"dpop_host_nonce"} // ""
$session->{"dpop_host_nonce"}
Truth table66%2/3
A and B
A= length $new_nonceB= $new_nonce ne ($session->{"dpop_host_nonce"} // "")
Truth table50%1/2
A
A= $session->{"dpop_host_nonce"}
| |||||||||||||||||||||||||||||||||||||||
| 68 | 3 | $session->{dpop_host_nonce} = $new_nonce; | |||||||||||||||||||||||||||||||||||||
| 69 | 3 | $self->oauth->_update_stored_session($session->{account_did}, $session->{session_id}, {dpop_host_nonce => $new_nonce}); | |||||||||||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||
| 72 | 11 | ▶ | if (($res->code // 0) == 401) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$res->code // 0
MC/DC0%0/1
$res->code // 0
$res->code
Truth table50%1/2
A
A= $res->code
| |||||||||||||||||||||||||||||||||||||||
| 73 | 4 | ▶ | if (length($new_nonce) && $nonce_retries_left > 0) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
length $new_nonce and $nonce_retries_left > 0
MC/DC50%1/2
length $new_nonce and $nonce_retries_left > 0
length $new_nonce
$nonce_retries_left > 0
Truth table66%2/3
A and B
A= length $new_nonceB= $nonce_retries_left > 0
| |||||||||||||||||||||||||||||||||||||||
| 74 | 1 | $self->log->debug('request: retrying with fresh DPoP-Nonce') if DEBUG; | |||||||||||||||||||||||||||||||||||||
| 75 | 1 | return $self->_request_with_session($session, $method, $path, $body, $nonce_retries_left - 1, $refresh_retries_left); | |||||||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||||||||
| 77 | 3 | ▶ | if ($refresh_retries_left > 0) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 78 | 2 | $self->log->debug('request: refreshing access token and retrying') if DEBUG; | |||||||||||||||||||||||||||||||||||||
| 79 | 2 | $session = $self->oauth->refresh_tokens($session); | |||||||||||||||||||||||||||||||||||||
| 80 | 2 | return $self->_request_with_session($session, $method, $path, $body, $nonce_retries_left, $refresh_retries_left - 1); | |||||||||||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||||||||||||
| 82 | 1 | die "request failed (HTTP 401): session could not be refreshed\n"; | |||||||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||
| 85 | 7 | ▶ | die $self->_error_message($tx, $res) unless $res->is_success; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 86 | 6 | return $res->json; | |||||||||||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||
| 89 | 6 | ▶ | sub _request_with_session_p($self, $session, $method, $path, $body, $nonce_retries_left, $refresh_retries_left) { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
_request_with_session_p: called CC=2 SCAR=7.2
| |||||||||||||||||||||||||||||||||||||||
| 90 | 6 | my $url = Mojo::URL->new($session->{host_url})->path($path); | |||||||||||||||||||||||||||||||||||||
| 91 | 6 | my $dpop_key = Mojo::ATProto::OAuth::DPoP->import_private_pem($session->{dpop_private_key_pem}); | |||||||||||||||||||||||||||||||||||||
| 92 | my $dpop_jwt = Mojo::ATProto::OAuth::DPoP->proof( | ||||||||||||||||||||||||||||||||||||||
| 93 | key => $dpop_key, method => $method, url => $url->to_string, | ||||||||||||||||||||||||||||||||||||||
| 94 | nonce => $session->{dpop_host_nonce}, access_token => $session->{access_token}, | ||||||||||||||||||||||||||||||||||||||
| 95 | issuer => $session->{auth_server_url}, | ||||||||||||||||||||||||||||||||||||||
| 96 | 6 | ); | |||||||||||||||||||||||||||||||||||||
| 97 | 6 | $self->log->debug("request_p: $method $url") if DEBUG; | |||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||
| 99 | 6 | my $headers = {Authorization => 'DPoP ' . $session->{access_token}, DPoP => $dpop_jwt}; | |||||||||||||||||||||||||||||||||||||
| 100 | 6 | ▶ | my @extra = defined($body) ? (json => $body) : (); | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 101 | 6 | my $ua_method = "${method}_p"; | |||||||||||||||||||||||||||||||||||||
| 102 | 6 | ▶ | return $self->ua->$ua_method($url, $headers, @extra)->then(sub($tx) { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=17.1
| |||||||||||||||||||||||||||||||||||||||
| 103 | 6 | my $res = $tx->res; | |||||||||||||||||||||||||||||||||||||
| 104 | 6 | ▶ | my $new_nonce = $res->headers->header('DPoP-Nonce') // ''; | ||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$res->headers->header("DPoP-Nonce") // ""
MC/DC100%1/1
$res->headers->header("DPoP-Nonce") // ""
$res->headers->header("DPoP-Nonce")
Truth table100%2/2
A
A= $res->headers->header("DPoP-Nonce")
| |||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||
| 106 | 6 | my $nonce_saved_p = Mojo::Promise->resolve; | |||||||||||||||||||||||||||||||||||||
| 107 | 6 | ▶ | if (length($new_nonce) && $new_nonce ne ($session->{dpop_host_nonce} // '')) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition60%3/5
length $new_nonce and $new_nonce ne ($session->{"dpop_host_nonce"} // "")
$session->{"dpop_host_nonce"} // ""
MC/DC50%1/2
length $new_nonce and $new_nonce ne ($session->{"dpop_host_nonce"} // "")
length $new_nonce
$new_nonce ne ($session->{"dpop_host_nonce"} // "")
MC/DC0%0/1
$session->{"dpop_host_nonce"} // ""
$session->{"dpop_host_nonce"}
Truth table66%2/3
A and B
A= length $new_nonceB= $new_nonce ne ($session->{"dpop_host_nonce"} // "")
Truth table50%1/2
A
A= $session->{"dpop_host_nonce"}
| |||||||||||||||||||||||||||||||||||||||
| 108 | 1 | $session->{dpop_host_nonce} = $new_nonce; | |||||||||||||||||||||||||||||||||||||
| 109 | 1 | $nonce_saved_p = $self->oauth->_update_stored_session_p($session->{account_did}, $session->{session_id}, {dpop_host_nonce => $new_nonce}); | |||||||||||||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||
| 112 | 6 | ▶ | return $nonce_saved_p->then(sub { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=7 SCAR=22.6
| |||||||||||||||||||||||||||||||||||||||
| 113 | 6 | ▶ | if (($res->code // 0) == 401) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$res->code // 0
MC/DC0%0/1
$res->code // 0
$res->code
Truth table50%1/2
A
A= $res->code
| |||||||||||||||||||||||||||||||||||||||
| 114 | 2 | ▶ | if (length($new_nonce) && $nonce_retries_left > 0) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
length $new_nonce and $nonce_retries_left > 0
MC/DC0%0/2
length $new_nonce and $nonce_retries_left > 0
length $new_nonce
$nonce_retries_left > 0
Truth table33%1/3
A and B
A= length $new_nonceB= $nonce_retries_left > 0
| |||||||||||||||||||||||||||||||||||||||
| 115 | 0 | $self->log->debug('request_p: retrying with fresh DPoP-Nonce') if DEBUG; | |||||||||||||||||||||||||||||||||||||
| 116 | 0 | return $self->_request_with_session_p($session, $method, $path, $body, $nonce_retries_left - 1, $refresh_retries_left); | |||||||||||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||||||||||||
| 118 | 2 | ▶ | if ($refresh_retries_left > 0) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 119 | 2 | $self->log->debug('request_p: refreshing access token and retrying') if DEBUG; | |||||||||||||||||||||||||||||||||||||
| 120 | 2 | ▶ | return $self->oauth->refresh_tokens_p($session)->then(sub($refreshed) { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 121 | 2 | return $self->_request_with_session_p($refreshed, $method, $path, $body, $nonce_retries_left, $refresh_retries_left - 1); | |||||||||||||||||||||||||||||||||||||
| 122 | 2 | }); | |||||||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||||||||
| 124 | 0 | die "request_p failed (HTTP 401): session could not be refreshed\n"; | |||||||||||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||
| 127 | 4 | ▶ | die $self->_error_message($tx, $res) unless $res->is_success; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 128 | 4 | return $res->json; | |||||||||||||||||||||||||||||||||||||
| 129 | 6 | }); | |||||||||||||||||||||||||||||||||||||
| 130 | 6 | }); | |||||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||
| 133 | # Extracts the XRPC response's machine-readable `error` field (e.g. | ||||||||||||||||||||||||||||||||||||||
| 134 | # 'InvalidSwap') alongside the human-readable `message`, so a caller can | ||||||||||||||||||||||||||||||||||||||
| 135 | # distinguish error *kinds* (e.g. a swapRecord conflict) without needing | ||||||||||||||||||||||||||||||||||||||
| 136 | # a blessed exception type - matches this library's "no models" rule. | ||||||||||||||||||||||||||||||||||||||
| 137 | 1 | ▶ | sub _error_message($self, $tx, $res) { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
_error_message: called CC=8 SCAR=27.0
| |||||||||||||||||||||||||||||||||||||||
| 138 | 1 | my $json_body = eval { $res->json }; | |||||||||||||||||||||||||||||||||||||
| 139 | 1 | ▶ | my $message = (ref($json_body) eq 'HASH' && defined($json_body->{message})) ? $json_body->{message} : ($tx->error->{message} // 'unknown error'); | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition20%1/5
ref $json_body eq "HASH" and defined $json_body->{"message"}
$tx->error->{"message"} // "unknown error"
MC/DC0%0/2
ref $json_body eq "HASH" and defined $json_body->{"message"}
ref $json_body eq "HASH"
defined $json_body->{"message"}
MC/DC0%0/1
$tx->error->{"message"} // "unknown error"
$tx->error->{"message"}
Truth table33%1/3
A and B
A= ref $json_body eq "HASH"B= defined $json_body->{"message"}
Truth table0%0/2
A
A= $tx->error->{"message"}
| |||||||||||||||||||||||||||||||||||||||
| 140 | 1 | ▶ | my $xrpc_error = (ref($json_body) eq 'HASH' && defined($json_body->{error})) ? $json_body->{error} : undef; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
ref $json_body eq "HASH" and defined $json_body->{"error"}
MC/DC0%0/2
ref $json_body eq "HASH" and defined $json_body->{"error"}
ref $json_body eq "HASH"
defined $json_body->{"error"}
Truth table33%1/3
A and B
A= ref $json_body eq "HASH"B= defined $json_body->{"error"}
| |||||||||||||||||||||||||||||||||||||||
| 141 | 1 | ▶ | return 'request failed (HTTP ' . ($res->code // 'connection error') | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$res->code // "connection error"
MC/DC0%0/1
$res->code // "connection error"
$res->code
Truth table50%1/2
A
A= $res->code
| |||||||||||||||||||||||||||||||||||||||
| 142 | . (defined($xrpc_error) ? ", xrpc_error=$xrpc_error" : '') . "): $message\n"; | ||||||||||||||||||||||||||||||||||||||
| 143 | } | ||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||
| 145 | 7 | 1; | |||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||
| 147 | __END__ | ||||||||||||||||||||||||||||||||||||||