On July 24, 1998 at 16:32, maurice matiz wrote:

> when an attachment is a web page and sent via Netscape (others may do the
> same), the mime type is defined as multipart/mixed. With the default settings
> ,
> Mhonarc handles the text within the page ok, but any relative links (includin
> g
> images) are not changed to absolute links. That is the Content-Base setting i
> s
> not used. 
> 
> i would imagine this is not a new issue, although i could not find any
> references in the mail list archives. Does anyone have a sample filter that
> takes care of the multipart/mixed mime type correctly and can send it to me?
> or is there something more obvious that needs to be done.

It relates to the MHTML support that has been discussed a couple
of times before.  But that has been more about the multipart/related
support; which the current mhonarc code base makes it a troublesome
thing to support.

However, to just deal with your particular problem, a solution is to
modify the text/html filter (mhtxthtml.pl) to look at the Content-Base
and Content-Location headers and set $base.

Here is the original code chunk in mhtxthtml.pl to target:

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

Since the <BASE> element should take highest precedence, we can add
the check for Content-Base and Content-Location headers to determine
what $base should be.  New code (UNTESTED):

    ## Get/remove BASE url
    if ($data =~ s%(<base\s[^>]*>)%%i) {
        $tmp = $1;
        ($base) = $tmp =~ m%href\s*=\s*['"]([^'"]+)['"]%i;

    } elsif (defined($tmp = %fields{'content-base'}) ||
             defined($tmp = %fields{'content-location'})) {
        ($base) = $tmp =~ s/["']\s//;
    }
    $base =~ s%(.*/).*%$1%;

Try it out, and tell us if it works.  If so, I'll add it to the next
release.

        --ewh

----
             Earl Hood              | University of California: Irvine
      [EMAIL PROTECTED]      |      Electronic Loiterer
http://www.oac.uci.edu/indiv/ehood/ | Dabbler of SGML/WWW/Perl/MIME

Reply via email to