line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mail::DMARC::Report::Send::HTTP; |
2
|
10
|
|
|
10
|
|
68
|
use strict; |
|
10
|
|
|
|
|
19
|
|
|
10
|
|
|
|
|
302
|
|
3
|
10
|
|
|
10
|
|
57
|
use warnings; |
|
10
|
|
|
|
|
22
|
|
|
10
|
|
|
|
|
472
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '1.20230215'; |
6
|
|
|
|
|
|
|
|
7
|
10
|
|
|
10
|
|
58
|
use Carp; |
|
10
|
|
|
|
|
21
|
|
|
10
|
|
|
|
|
634
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
#use Data::Dumper; |
10
|
|
|
|
|
|
|
#use HTTP::Tiny; # a possibility |
11
|
|
|
|
|
|
|
#use Net::HTTP; # lazy loaded in 'post' |
12
|
|
|
|
|
|
|
|
13
|
10
|
|
|
10
|
|
69
|
use parent 'Mail::DMARC::Base'; |
|
10
|
|
|
|
|
28
|
|
|
10
|
|
|
|
|
75
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub post { |
16
|
0
|
|
|
0
|
0
|
|
my ( $self, $uri, $report, $gz ) = @_; |
17
|
|
|
|
|
|
|
|
18
|
0
|
|
|
|
|
|
carp "http send feature not complete!"; |
19
|
0
|
|
|
|
|
|
return; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
## no critic (Unreachable,Eval) |
22
|
|
|
|
|
|
|
# TODO: test against real HTTP server, validate HTTP response |
23
|
0
|
0
|
|
|
|
|
eval "require Net::HTTP" or return; |
24
|
|
|
|
|
|
|
|
25
|
0
|
|
|
|
|
|
my $ver = $Mail::DMARC::Base::VERSION; |
26
|
0
|
0
|
|
|
|
|
my $s = Net::HTTP->new( Host => $uri->host ) or croak $@; |
27
|
0
|
|
|
|
|
|
$s->write_request( |
28
|
|
|
|
|
|
|
POST => $uri->path, |
29
|
|
|
|
|
|
|
'User-Agent' => "Mail::DMARC/$ver" |
30
|
|
|
|
|
|
|
); |
31
|
0
|
|
|
|
|
|
my ( $code, $mess, %h ) = $s->read_response_headers; |
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
while (1) { |
34
|
0
|
|
|
|
|
|
my $buf; |
35
|
0
|
|
|
|
|
|
my $n = $s->read_entity_body( $buf, 1024 ); |
36
|
0
|
0
|
|
|
|
|
croak "read failed: $!" unless defined $n; |
37
|
0
|
0
|
|
|
|
|
last unless $n; |
38
|
0
|
|
|
|
|
|
print $buf; |
39
|
0
|
|
|
|
|
|
return 1; |
40
|
|
|
|
|
|
|
} |
41
|
0
|
|
|
|
|
|
return 0; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
__END__ |