line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mail::DKIM::Canonicalization::dk_simple; |
2
|
7
|
|
|
7
|
|
55
|
use strict; |
|
7
|
|
|
|
|
13
|
|
|
7
|
|
|
|
|
247
|
|
3
|
7
|
|
|
7
|
|
39
|
use warnings; |
|
7
|
|
|
|
|
17
|
|
|
7
|
|
|
|
|
275
|
|
4
|
|
|
|
|
|
|
our $VERSION = '1.20230212'; # VERSION |
5
|
|
|
|
|
|
|
# ABSTRACT: dk simple canonicalization |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# Copyright 2005 Messiah College. All rights reserved. |
8
|
|
|
|
|
|
|
# Jason Long |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# This program is free software; you can redistribute it and/or |
11
|
|
|
|
|
|
|
# modify it under the same terms as Perl itself. |
12
|
|
|
|
|
|
|
|
13
|
7
|
|
|
7
|
|
47
|
use base 'Mail::DKIM::Canonicalization::DkCommon'; |
|
7
|
|
|
|
|
25
|
|
|
7
|
|
|
|
|
3163
|
|
14
|
7
|
|
|
7
|
|
50
|
use Carp; |
|
7
|
|
|
|
|
25
|
|
|
7
|
|
|
|
|
2067
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub init { |
17
|
21
|
|
|
21
|
0
|
42
|
my $self = shift; |
18
|
21
|
|
|
|
|
86
|
$self->SUPER::init; |
19
|
|
|
|
|
|
|
|
20
|
21
|
|
|
|
|
44
|
$self->{canonicalize_body_empty_lines} = 0; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub canonicalize_header { |
24
|
123
|
|
|
123
|
0
|
190
|
my $self = shift; |
25
|
123
|
50
|
|
|
|
264
|
croak 'wrong number of parameters' unless ( @_ == 1 ); |
26
|
123
|
|
|
|
|
205
|
my ($line) = @_; |
27
|
|
|
|
|
|
|
|
28
|
123
|
|
|
|
|
345
|
return $line; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub canonicalize_body { |
32
|
42
|
|
|
42
|
0
|
70
|
my $self = shift; |
33
|
42
|
|
|
|
|
85
|
my ($multiline) = @_; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
# ignore empty lines at the end of the message body |
36
|
|
|
|
|
|
|
# |
37
|
|
|
|
|
|
|
# (i.e. do not emit empty lines until a following nonempty line |
38
|
|
|
|
|
|
|
# is found) |
39
|
|
|
|
|
|
|
# |
40
|
42
|
|
|
|
|
77
|
my $empty_lines = $self->{canonicalize_body_empty_lines}; |
41
|
|
|
|
|
|
|
|
42
|
42
|
100
|
|
|
|
162
|
if ( $multiline =~ s/^((?:\015\012)+)// ) |
43
|
|
|
|
|
|
|
{ # count & strip leading empty lines |
44
|
21
|
|
|
|
|
79
|
$empty_lines += length($1) / 2; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
42
|
100
|
66
|
|
|
189
|
if ( $empty_lines > 0 && length($multiline) > 0 ) |
48
|
|
|
|
|
|
|
{ # re-insert leading white if any nonempty lines exist |
49
|
21
|
|
|
|
|
89
|
$multiline = ( "\015\012" x $empty_lines ) . $multiline; |
50
|
21
|
|
|
|
|
51
|
$empty_lines = 0; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
42
|
|
|
|
|
131
|
while ( $multiline =~ /\015\012\015\012\z/ ) |
54
|
|
|
|
|
|
|
{ # count & strip trailing empty lines |
55
|
27
|
|
|
|
|
49
|
chop $multiline; |
56
|
27
|
|
|
|
|
38
|
chop $multiline; |
57
|
27
|
|
|
|
|
68
|
$empty_lines++; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
42
|
|
|
|
|
77
|
$self->{canonicalize_body_empty_lines} = $empty_lines; |
61
|
42
|
|
|
|
|
139
|
return $multiline; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
1; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
__END__ |