summaryrefslogtreecommitdiff
path: root/fml/lib/Mail/Message.pm
diff options
context:
space:
mode:
authorfukachan <fukachan>2001-04-12 15:11:13 +0000
committerfukachan <fukachan>2001-04-12 15:11:13 +0000
commit4f99eafc606cd102a1a6cec750444c98f1ef8e2c (patch)
tree356f91322b13eef5e7798ea67977740d8de4b2e7 /fml/lib/Mail/Message.pm
parentb2837e81b96bf069a708efc76b08b7ce52050c85 (diff)
downloadfml8-4f99eafc606cd102a1a6cec750444c98f1ef8e2c.tar.gz
fml8-4f99eafc606cd102a1a6cec750444c98f1ef8e2c.tar.bz2
fml8-4f99eafc606cd102a1a6cec750444c98f1ef8e2c.zip
enforce to parse broken multipart message ;)
bug fix to parse Content-Type: ... phrase
Diffstat (limited to 'fml/lib/Mail/Message.pm')
-rw-r--r--fml/lib/Mail/Message.pm10
1 files changed, 8 insertions, 2 deletions
diff --git a/fml/lib/Mail/Message.pm b/fml/lib/Mail/Message.pm
index a42504c2..4d7974f8 100644
--- a/fml/lib/Mail/Message.pm
+++ b/fml/lib/Mail/Message.pm
@@ -4,7 +4,7 @@
# All rights reserved. This program is free software; you can
# redistribute it and/or modify it under the same terms as Perl itself.
#
-# $FML: Message.pm,v 1.13 2001/04/10 11:48:06 fukachan Exp $
+# $FML: Message.pm,v 1.14 2001/04/12 13:00:49 fukachan Exp $
#
package Mail::Message;
@@ -1010,6 +1010,9 @@ sub parse_and_build_mime_multipart_chain
my $pe = $mpb_begin; # pe = position of the end in $data
$self->_set_pos( $pe + 1 );
+ # fix the end of multipart block against broken MIME/multipart
+ $mpb_end = ($data_end - 1) if $mpb_end < 0;
+
# prepare lexical variables
my ($msg, $next_part, $prev_part, @m);
my $i = 0; # counter to indicate the $i-th message
@@ -1103,7 +1106,7 @@ sub _get_data_type
my ($args, $default) = @_;
my $buf = $args->{ header } || '';
- if ($buf =~ /Content-Type:\s*(\S+)(\;|\s*$)/) {
+ if ($buf =~ /Content-Type:\s*(\S+)(\n|\;|\s*$)/) {
return $1;
}
else {
@@ -1124,6 +1127,9 @@ sub _get_mime_header
elsif ($buf =~ /Content-Type:\s*(\S+)\s*$/) {
return ($buf, $pos + 1);
}
+ elsif ($buf =~ /Content-Type:\s*(\S+)\s*/) {
+ return ($buf, $pos + 1);
+ }
else {
return ('', $pos_begin);
}