line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
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
|
1
|
|
|
1
|
|
3
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
23
|
|
22
|
1
|
|
|
1
|
|
2
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
21
|
|
23
|
|
|
|
|
|
|
|
24
|
1
|
|
|
1
|
|
3
|
use parent qw( Net::ACME::X::HashBase ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
3
|
|
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
|
1
|
|
|
1
|
|
42
|
use constant BODY_DISPLAY_SIZE => 1_024; |
|
1
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
141
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
#named args required: |
33
|
|
|
|
|
|
|
# |
34
|
|
|
|
|
|
|
# method |
35
|
|
|
|
|
|
|
# reason |
36
|
|
|
|
|
|
|
# url |
37
|
|
|
|
|
|
|
# status |
38
|
|
|
|
|
|
|
# |
39
|
|
|
|
|
|
|
sub new { |
40
|
3
|
|
|
3
|
0
|
3
|
my ( $self, $args_hr ) = @_; |
41
|
|
|
|
|
|
|
|
42
|
3
|
|
|
|
|
4
|
my $content = $args_hr->{'content'}; |
43
|
3
|
100
|
100
|
|
|
12
|
if ( defined($content) && length($content) > BODY_DISPLAY_SIZE() ) { |
44
|
1
|
|
|
|
|
3
|
substr( $content, BODY_DISPLAY_SIZE() ) = '…'; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
3
|
|
100
|
|
|
7
|
$content ||= q<>; |
48
|
|
|
|
|
|
|
|
49
|
3
|
|
|
|
|
18
|
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
|
|
|
|
|
|
|
1; |