diff options
| author | fukachan <fukachan> | 2001-02-03 15:29:44 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2001-02-03 15:29:44 +0000 |
| commit | 2bd489278fc3d72ff6b8107324a4726777ba0fc5 (patch) | |
| tree | 7e742a2f931c76dc4f7f808279452c2e12fcc8b4 /fml/lib | |
| parent | c7d058fd25ba2d1ee41c4d784c60484122abc742 (diff) | |
| download | fml8-2bd489278fc3d72ff6b8107324a4726777ba0fc5.tar.gz fml8-2bd489278fc3d72ff6b8107324a4726777ba0fc5.tar.bz2 fml8-2bd489278fc3d72ff6b8107324a4726777ba0fc5.zip | |
fix multipart handling when the preamble is empty
Diffstat (limited to 'fml/lib')
| -rw-r--r-- | fml/lib/MailingList/Messages.pm | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/fml/lib/MailingList/Messages.pm b/fml/lib/MailingList/Messages.pm index dd98d997..46947a3a 100644 --- a/fml/lib/MailingList/Messages.pm +++ b/fml/lib/MailingList/Messages.pm @@ -298,28 +298,37 @@ sub parse_mime_multipart # pb = position of the beginning, pe = position of the end my ($msg, $next_part, $prev_part, @m); my $i = 0; + + # check the preamble before multipart blocks my $pb = 0; my $pe = $buf_begin; $self->_set_pos( $pe + 1 ); do { - $m[ $i++ ] = _alloc_new_part($self, { - boundary => $boundary, - offset_begin => $pb, - offset_end => $pe, - content => $content, - }); + # XXX not effective region if $pe <= $pb + # we should check this to avoid the empty preamble case. + if ($pe > $pb) { + $m[ $i++ ] = _alloc_new_part($self, { + boundary => $boundary, + offset_begin => $pb, + offset_end => $pe, + content => $content, + }); + } ($pb, $pe) = $self->_next_part_pos($content, $boundary); + # the closing of the blocks if ($pe > $buf_end) { $boundary .= "--";} - my $buf = $boundary."\n"; + + # add the multipart delimiter $m[ $i++ ] = _alloc_new_part($self, { content => \$buf }); } while ($pe <= $buf_end); + # check the trailor after multipart blocks exists or not. my $p = index($$content, "\n", $buf_end) + 1; if (($content_length - $p) > 0) { $m[ $i++ ] = _alloc_new_part($self, { @@ -330,6 +339,7 @@ sub parse_mime_multipart }); } + # build a chain of multipart blocks and delimeters my $j = 0; for ($j = 0; $j < $i; $j++) { if (defined $m[ $j + 1 ]) { @@ -341,8 +351,6 @@ sub parse_mime_multipart } next_chain($self, $m[0]); - - # use Data::Dumper; print Dumper( $self ); } |
