| 1 | package Mail::DMARC::Report::Send::HTTP; | ||||||||||
| 2 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 2 | ▶ | use feature 'signatures'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 2 | our $VERSION = '2.20261110'; | |||||||||
| 7 | |||||||||||
| 8 | 2 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | #use Data::Dumper; | ||||||||||
| 11 | #use HTTP::Tiny; # a possibility | ||||||||||
| 12 | #use Net::HTTP; # lazy loaded in 'post' | ||||||||||
| 13 | |||||||||||
| 14 | 2 | ▶ | use parent 'Mail::DMARC::Base'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 15 | |||||||||||
| 16 | 0 | ▶ | sub post( $self, $uri, $report, $gz ) { | ||||||||
|
Subroutine
post: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||
| 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 | ▶ | eval "require Net::HTTP" or return; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 24 | |||||||||||
| 25 | 0 | my $ver = $Mail::DMARC::Base::VERSION; | |||||||||
| 26 | 0 | ▶ | my $s = Net::HTTP->new( Host => $uri->host ) or croak $@; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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 | ▶ | croak "read failed: $!" unless defined $n; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 37 | 0 | ▶ | last unless $n; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 38 | 0 | print $buf; | |||||||||
| 39 | 0 | return 1; | |||||||||
| 40 | } | ||||||||||
| 41 | 0 | return 0; | |||||||||
| 42 | } | ||||||||||
| 43 | |||||||||||
| 44 | 2 | 1; | |||||||||
| 45 | |||||||||||
| 46 | __END__ | ||||||||||