« lib/Mail/DMARC/PurePerl.pm
↑ Summary
blib/lib/Mail/DMARC/Report/Aggregate/Record/Auth_Results/DKIM.pm »
| 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.20260827'; | |||||||||
| 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__ | ||||||||||
| 47 | |||||||||||
| 48 | =pod | ||||||||||
| 49 | |||||||||||
| 50 | =head1 NAME | ||||||||||
| 51 | |||||||||||
| 52 | Mail::DMARC::Report::Send::HTTP - utility methods to send reports by HTTP | ||||||||||
| 53 | |||||||||||
| 54 | =head1 VERSION | ||||||||||
| 55 | |||||||||||
| 56 | version 2.20260827 | ||||||||||
| 57 | |||||||||||
| 58 | =head1 12.2.2. HTTP | ||||||||||
| 59 | |||||||||||
| 60 | Where an "http" or "https" method is requested in a Domain Owner's | ||||||||||
| 61 | URI list, the Mail Receiver MAY encode the data using the | ||||||||||
| 62 | "application/gzip" media type ([GZIP]) or MAY send the Appendix C | ||||||||||
| 63 | data uncompressed or unencoded. | ||||||||||
| 64 | |||||||||||
| 65 | The header portion of the POST or PUT request SHOULD contain a | ||||||||||
| 66 | Subject field as described in Section 12.2.1. | ||||||||||
| 67 | |||||||||||
| 68 | HTTP permits the use of Content-Transfer-Encoding to upload gzip | ||||||||||
| 69 | content using the POST or PUT instruction after translating the | ||||||||||
| 70 | content to 7-bit ASCII. | ||||||||||
| 71 | |||||||||||
| 72 | =head1 AUTHORS | ||||||||||
| 73 | |||||||||||
| 74 | =over 4 | ||||||||||
| 75 | |||||||||||
| 76 | =item * | ||||||||||
| 77 | |||||||||||
| 78 | Matt Simerson <msimerson@cpan.org> | ||||||||||
| 79 | |||||||||||
| 80 | =item * | ||||||||||
| 81 | |||||||||||
| 82 | Davide Migliavacca <shari@cpan.org> | ||||||||||
| 83 | |||||||||||
| 84 | =item * | ||||||||||
| 85 | |||||||||||
| 86 | Marc Bradshaw <marc@marcbradshaw.net> | ||||||||||
| 87 | |||||||||||
| 88 | =back | ||||||||||
| 89 | |||||||||||
| 90 | =head1 COPYRIGHT AND LICENSE | ||||||||||
| 91 | |||||||||||
| 92 | This software is copyright (c) 2026 by Matt Simerson. | ||||||||||
| 93 | |||||||||||
| 94 | This is free software; you can redistribute it and/or modify it under | ||||||||||
| 95 | the same terms as the Perl 5 programming language system itself. | ||||||||||
| 96 | |||||||||||
| 97 | =cut | ||||||||||