line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mail::DKIM::Canonicalization::dk_simple; |
2
|
7
|
|
|
7
|
|
50
|
use strict; |
|
7
|
|
|
|
|
15
|
|
|
7
|
|
|
|
|
199
|
|
3
|
7
|
|
|
7
|
|
34
|
use warnings; |
|
7
|
|
|
|
|
14
|
|
|
7
|
|
|
|
|
296
|
|
4
|
|
|
|
|
|
|
our $VERSION = '1.20230630'; # 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
|
|
41
|
use base 'Mail::DKIM::Canonicalization::DkCommon'; |
|
7
|
|
|
|
|
20
|
|
|
7
|
|
|
|
|
3245
|
|
14
|
7
|
|
|
7
|
|
48
|
use Carp; |
|
7
|
|
|
|
|
16
|
|
|
7
|
|
|
|
|
2081
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub init { |
17
|
21
|
|
|
21
|
0
|
39
|
my $self = shift; |
18
|
21
|
|
|
|
|
85
|
$self->SUPER::init; |
19
|
|
|
|
|
|
|
|
20
|
21
|
|
|
|
|
50
|
$self->{canonicalize_body_empty_lines} = 0; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub canonicalize_header { |
24
|
123
|
|
|
123
|
0
|
203
|
my $self = shift; |
25
|
123
|
50
|
|
|
|
255
|
croak 'wrong number of parameters' unless ( @_ == 1 ); |
26
|
123
|
|
|
|
|
194
|
my ($line) = @_; |
27
|
|
|
|
|
|
|
|
28
|
123
|
|
|
|
|
356
|
return $line; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub canonicalize_body { |
32
|
42
|
|
|
42
|
0
|
66
|
my $self = shift; |
33
|
42
|
|
|
|
|
115
|
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
|
|
|
|
|
78
|
my $empty_lines = $self->{canonicalize_body_empty_lines}; |
41
|
|
|
|
|
|
|
|
42
|
42
|
100
|
|
|
|
155
|
if ( $multiline =~ s/^((?:\015\012)+)// ) |
43
|
|
|
|
|
|
|
{ # count & strip leading empty lines |
44
|
21
|
|
|
|
|
89
|
$empty_lines += length($1) / 2; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
42
|
100
|
66
|
|
|
184
|
if ( $empty_lines > 0 && length($multiline) > 0 ) |
48
|
|
|
|
|
|
|
{ # re-insert leading white if any nonempty lines exist |
49
|
21
|
|
|
|
|
75
|
$multiline = ( "\015\012" x $empty_lines ) . $multiline; |
50
|
21
|
|
|
|
|
42
|
$empty_lines = 0; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
42
|
|
|
|
|
131
|
while ( $multiline =~ /\015\012\015\012\z/ ) |
54
|
|
|
|
|
|
|
{ # count & strip trailing empty lines |
55
|
27
|
|
|
|
|
52
|
chop $multiline; |
56
|
27
|
|
|
|
|
33
|
chop $multiline; |
57
|
27
|
|
|
|
|
70
|
$empty_lines++; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
42
|
|
|
|
|
84
|
$self->{canonicalize_body_empty_lines} = $empty_lines; |
61
|
42
|
|
|
|
|
140
|
return $multiline; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
1; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
__END__ |