line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mail::BIMI::Role::HasHTTPClient; |
2
|
|
|
|
|
|
|
# ABSTRACT: Class to model a HTTP client |
3
|
|
|
|
|
|
|
our $VERSION = '3.20210512'; # VERSION |
4
|
29
|
|
|
29
|
|
20181
|
use 5.20.0; |
|
29
|
|
|
|
|
120
|
|
5
|
29
|
|
|
29
|
|
182
|
use Moose::Role; |
|
29
|
|
|
|
|
64
|
|
|
29
|
|
|
|
|
242
|
|
6
|
29
|
|
|
29
|
|
157468
|
use Mail::BIMI::Prelude; |
|
29
|
|
|
|
|
81
|
|
|
29
|
|
|
|
|
252
|
|
7
|
29
|
|
|
29
|
|
25219
|
use HTTP::Tiny::Paranoid; |
|
29
|
|
|
|
|
2807742
|
|
|
29
|
|
|
|
|
11760
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
has http_client => ( is => 'rw', lazy => 1, builder => '_build_http_client', |
10
|
|
|
|
|
|
|
documentation => 'HTTP::Tiny::Paranoid (or similar) object used for HTTP operations' ); |
11
|
|
|
|
|
|
|
requires 'http_client_max_fetch_size'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
{ |
15
|
|
|
|
|
|
|
my $http_client; |
16
|
20
|
|
|
20
|
|
54
|
sub _build_http_client($self) { |
|
20
|
|
|
|
|
52
|
|
|
20
|
|
|
|
|
51
|
|
17
|
20
|
100
|
|
|
|
447
|
return $http_client if $http_client; |
18
|
8
|
|
50
|
|
|
81
|
my $agent = 'Mail::BIMI ' . ( $Mail::BIMI::Version // 'dev' ) . '/1.0'; |
19
|
8
|
|
|
|
|
87
|
$http_client = HTTP::Tiny::Paranoid->new( |
20
|
|
|
|
|
|
|
agent => $agent, |
21
|
|
|
|
|
|
|
max_size => $self->http_client_max_fetch_size, |
22
|
|
|
|
|
|
|
max_redirect => $self->bimi_object->options->http_client_max_redirect, |
23
|
|
|
|
|
|
|
timeout => $self->bimi_object->options->http_client_timeout, |
24
|
|
|
|
|
|
|
verify_SSL => 1, # Certificates MUST verify |
25
|
|
|
|
|
|
|
default_headers => { |
26
|
|
|
|
|
|
|
'accept-encoding' => 'identity', |
27
|
|
|
|
|
|
|
}, |
28
|
|
|
|
|
|
|
); |
29
|
8
|
|
|
|
|
1324
|
return $http_client; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
1; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
__END__ |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=pod |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=encoding UTF-8 |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 NAME |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
Mail::BIMI::Role::HasHTTPClient - Class to model a HTTP client |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 VERSION |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
version 3.20210512 |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 DESCRIPTION |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Role for classes which require a HTTP Client implementation |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 REQUIRES |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=over 4 |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=item * L<HTTP::Tiny::Paranoid|HTTP::Tiny::Paranoid> |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=item * L<Mail::BIMI::Prelude|Mail::BIMI::Prelude> |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=item * L<Moose::Role|Moose::Role> |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=back |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 AUTHOR |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Marc Bradshaw <marc@marcbradshaw.net> |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
This software is copyright (c) 2020 by Marc Bradshaw. |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
74
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=cut |