Re: multipart/mixed filter for netscape mail

1998-07-27 14:36:51
Got it. 

    ## Get/remove BASE url
    if ($data =~ s%(<base\s[^>]*>)%%i) {
        $tmp = $1;
        ($base) = $tmp =~ m%href\s*=\s*['"]([^'"]+)['"]%i;
        $base =~ s%(.*/).*%$1%;
    } elsif (defined($tmp = $fields{'content-base'}) ||
             defined($tmp = $fields{'content-location'})) {
        $base = $tmp;
        $base =~ s/['"]//g;
        $base =~ s%(.*/).*%$1%;

If you do any variation of
        ($base) = $tmp =~ s/['"]//g;
$base gets set to the exit value of the s/ function.  This one's got
me before.  Found by printing out what the variables were getting set to.

I also put the last $base = inside the if/elsif so $base remains
undefined if neither is true.

Note.  According to RFC 2110, Content-Location is the page being
included in the mail, expressed either as an absolute URL or as a
relative URL to Content-Base or a BASE= tag.  Content-Base, like the
BASE= tag, is not a complete URL but the path to be prepended to other
relative URLs.  But when Netscape 4.05 does "send page" it puts the
absolute URL of the page being mailed into Content-Base, which is
wrong, to my understanding of RFC 2110 from a couple of readings.
Luckily, MHonArc handles this because it already knows to strip off
from the last "/" to the end.  Good!  Don't change that.

Joseph Brennan     Academic Information Systems
                   Columbia University in the City of New York