ACME/X/HTTP/Protocol.pm

filter: Statementstmt 100% 19 / 19 Branchbran 100% 2 / 2 Conditioncond 100% 5 / 5 MC/DCmcdc 100% 3 / 3 Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 1 totaltotal 97.1% 34 / 35 CC 4 SCAR 9.2
CC
4
Cov
100%
new
4.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.5
« ACME/HTTP/Response.pm ↑ Summary ACME/Challenge/Pending/http_01/Handler.pm »
1 package Net::ACME::X::HTTP::Protocol;
2  
3 =encoding utf-8
4  
5 =head1 NAME
6  
7 Net::ACME::X::HTTP::Protocol
8  
9 =head1 DESCRIPTION
10  
11 This exception class means that an error occurred with an HTTP
12 request, and the problem had specifically to do with something
13 that happened on the remote server, not just a general connection
14 problem. For example, this class would be suitable for use when
15 you get a 500 Internal Server Error or a 404 Not Found, but it
16 would not be suitable for use if you get a Connection Refused
17 error when trying to connect.
18  
19 =cut
20  
21 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 2 ▶use parent qw( Net::ACME::X::HashBase );
Subroutine BEGIN: called CC=1 SCAR=0.0
25  
26 # In a normal HTTP response, we don't necessarily know if the body is going
27 # to be meaningful for display, so only include the first chunk.
28 #
29 #(accessed from tests)
30 2 ▶use constant BODY_DISPLAY_SIZE => 1_024;
Subroutine BEGIN: called CC=1 SCAR=0.0
31  
32 #named args required:
33 #
34 # method
35 # reason
36 # url
37 # status
38 #
39 sub new {
40 4 ▶ my ( $self, $args_hr ) = @_;
Subroutine new: called CC=4 SCAR=13.9
Pod undocumented
41  
42 4 my $content = $args_hr->{'content'};
43 4 ▶ if ( defined($content) && length($content) > BODY_DISPLAY_SIZE() ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $content and length $content > 1024) 1 3 4
Condition100%3/3
defined $content and length $content > 1024
!ll&&!rl&&r
121
MC/DC100%2/2
defined $content and length $content > 1024
defined $content length $content > 1024
Truth table100%3/3
A and B
A= defined $contentB= length $content > 1024
ABresult
0X0
100
111
44 1 substr( $content, BODY_DISPLAY_SIZE() ) = '…';
45 }
46  
47 4 ▶ $content ||= q<>;
Condition100%2/2
$content ||= ""
l!l
31
MC/DC100%1/1
$content ||= ""
$content
Truth table100%2/2
A
A= $content
Aresult
11
00
48  
49 4 return $self->SUPER::new(
50 "The response to the HTTP “$args_hr->{'method'}” request from “$args_hr->{'url'}” indicated an error ($args_hr->{'status'}, $args_hr->{'reason'}): “$content”",
51 $args_hr,
52 );
53 }
54  
55 2 1;
« ACME/HTTP/Response.pm ↑ Summary ACME/Challenge/Pending/http_01/Handler.pm »