Mailing List Archive

svn commit: rev 6702 - in incubator/spamassassin/trunk/lib/Mail: . SpamAssassin
Author: felicity
Date: Mon Feb 16 20:26:57 2004
New Revision: 6702

Modified:
incubator/spamassassin/trunk/lib/Mail/SpamAssassin.pm
incubator/spamassassin/trunk/lib/Mail/SpamAssassin/MsgParser.pm
Log:
if a complete blank message is passed to parse(), pristine_headers would be undef which causes lots of error checking to have to go in... just default it to ''. also, _parse_body() was doing a CRLF->LF conversion on the whole message body, and then again for each multipart part, which is a waste since we did it all the first time. got rid of that.

Modified: incubator/spamassassin/trunk/lib/Mail/SpamAssassin.pm
==============================================================================
--- incubator/spamassassin/trunk/lib/Mail/SpamAssassin.pm (original)
+++ incubator/spamassassin/trunk/lib/Mail/SpamAssassin.pm Mon Feb 16 20:26:57 2004
@@ -979,7 +979,7 @@
}
}

- return $hdrs.join ('', @newbody);
+ return join ('', $hdrs, @newbody);
}

###########################################################################

Modified: incubator/spamassassin/trunk/lib/Mail/SpamAssassin/MsgParser.pm
==============================================================================
--- incubator/spamassassin/trunk/lib/Mail/SpamAssassin/MsgParser.pm (original)
+++ incubator/spamassassin/trunk/lib/Mail/SpamAssassin/MsgParser.pm Mon Feb 16 20:26:57 2004
@@ -84,6 +84,7 @@
# Generate the main object and parse the appropriate MIME-related headers into it.
my $msg = Mail::SpamAssassin::MsgContainer->new();
my $header = '';
+ $msg->{'pristine_headers'} = '';

# Go through all the headers of the message
while ( my $last = shift @message ) {
@@ -117,6 +118,11 @@
# Store the pristine body for later -- store as a copy since @message will get modified below
$msg->{'pristine_body'} = join('', @message);

+ # CRLF -> LF
+ for ( @message ) {
+ s/\r\n/\n/;
+ }
+
# Figure out the boundary
my ($boundary);
($msg->{'type'}, $boundary) = Mail::SpamAssassin::Util::parse_content_type($msg->header('content-type'));
@@ -149,11 +155,6 @@

sub _parse_body {
my($self, $msg, $_msg, $boundary, $body, $initial) = @_;
-
- # CRLF -> LF
- for ( @{$body} ) {
- s/\r\n/\n/;
- }

# Figure out the simple content-type, or set it to text/plain
my $type = $_msg->header('Content-Type') || 'text/plain; charset=us-ascii';