[rt-users] Migrate 1.0.7 to 2.0.4
Russ Johnson
russj at dimstar.net
Thu Aug 23 20:02:19 EDT 2001
Here's the code for that:
while ( my $header = shift @headers ) {
if ( $header =~
/^content-type:\s*multipart\/(alternative|mixed|report|signed|digest|related)\s*;/i
) {
my $two = 0;
my $boundary;
if ( $header =~
/;\s*boundary="?([\-\w\.\=\/\+\%]+)"?/i ) {
$boundary = $1;
} elsif ( $header =~ /;\s*boundary=\s*$/i ) {
#special case for actual boundary on next line
die unless $headers[0] =~
/\s+"?([\-\w\.\=\/\+\%]+)"?/i;
$boundary = $1;
$two = 1;
} elsif ( $headers[0] =~ /(^|;)\s*boundary="([
\-\w\.\=\/\+\%]+)"/i ) { #embedded space, quotes not optional
$boundary = $2;
$two = 1;
} elsif ( $headers[0] =~
/(^|;)\s*boundary="?([\-\w\.\=\/\+\%]+)"?/i ) {
$boundary = $2;
$two = 1;
} elsif ( $headers[1] =~
/(^|;)\s*boundary="?([\-\w\.\=\/\+\%]+)"?/i ) {
$boundary = $2;
$two = 2;
} elsif ( $headers[2] =~
/(^|;)\s*boundary="?([\-\w\.\=\/\+\%]+)"?/i ) {
#terrible false laziness.
$boundary = $2;
$two = 3;
} else {
die "can't parse $header for boundry";
}
warn "looking for $boundary in body\n" if $Debug;
unless ( grep /^(\-\-)?\Q$boundary\E(\-\-)?$/, @body ) {
splice(@headers, 0, $two);
until ( !scalar(@headers) || $headers[0] =~ /^\S/ ) {
warn "**WARNING throwing away header fragment:
". shift @headers;
}
warn "false Content-type: header removed\n";
next;
}
}
push @n_headers, $header;
}
Unfortunately, I'm nowhere near the perl programmer to know what would need
to be changed.
At 07:45 PM 8/23/2001 -0400, you wrote:
>On Thursday, August 23, 2001 19:36:36 -0400, Jesse Vincent
><jesse at bestpractical.com> wrote:
>+-----
>| It looks like the regexp in import-1.0-to-2.0 doesn't accept < and > as
>| boundary characters. One way to fix it would be to change the regexps
>| (I'd love a patch). The quick fix is probably to go edit the mail message
>| and change the boundary conditions by hand.
>+--->8
>
>It just occurred to me that that error should not be fatal, although
>dropping the ticket on the floor with a warning is fine. Anyone else get
>lots of copies of Sircam in their queues? :-/ There is a missing closing
>MIME boundary in the message it sends....
>
>--
>brandon s. allbery [os/2][linux][solaris][freebsd] allbery at kf8nh.apk.net
>system administrator [JAPH][WAY too many hats] allbery at ece.cmu.edu
>electrical and computer engineering KF8NH
>carnegie mellon university [linux: proof of the million monkeys theory]
>
>
>_______________________________________________
>rt-users mailing list
>rt-users at lists.fsck.com
>http://lists.fsck.com/mailman/listinfo/rt-users
Russ Johnson
Stargate Online
http://www.dimstar.net
telnet://telnet.dimstar.net
ICQ: 3739685
More information about the rt-users
mailing list