nmh-workers
[Top] [All Lists]

[Nmh-workers] application/octet-stream oddness

2008-09-20 12:18:47
i'm confused.  i confess i'm no expert on mime types and content
encodings, etc.

that being said, i would have thought that if i told mhbuild to use
"application/octet-stream", that it would check the whole file for
binary characters before deciding that no encoding was needed.

but that's not what i'm seeing happening, and indeed, the code in
scan_content() (in uip/mhbuildsbr.c) seems to check the file
contents incompletely.  the file is read with a series of fgets()
calls, which happily read through the entire file, but since
fgets() returns a C string pointer, none of the characters after
the first null are checked.

the CVS history on savannah implies the code has been this way since
it was first commited in '99, so i want to believe that i'm doing
something wrong, but it doesn't feel like it.

any thoughts?

paul

my message draft looks like:

To: pgf
Subject: test 7
Cc:
---------------------:

#application/octet-stream; name="testfile" [ - ] testfile

=---------------------
 paul fox, pgf(_at_)laptop(_dot_)org

the contents of "testfile" are:

 $ hexdump -C testfile
 00000000  61 00 80 80 80 80 80 80  80 80 80 80 80 80 80 0a  |a...............|
 00000010

the output of "mhbuild - <draft" is:

To: pgf
Subject: test 7
Cc:
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
Content-ID: 
<28641(_dot_)1221927308(_dot_)0(_at_)foxharp(_dot_)boston(_dot_)ma(_dot_)us>

------- =_aaaaaaaaaa0
Content-Type: application/octet-stream; name="testfile"
Content-ID: 
<28641(_dot_)1221927308(_dot_)1(_at_)foxharp(_dot_)boston(_dot_)ma(_dot_)us>
Content-Description:  - 

a

------- =_aaaaaaaaaa0
Content-Type: text/plain; charset="us-ascii"
Content-ID: 
<28641(_dot_)1221927308(_dot_)2(_at_)foxharp(_dot_)boston(_dot_)ma(_dot_)us>

=---------------------
 paul fox, pgf(_at_)laptop(_dot_)org

------- =_aaaaaaaaaa0--


the relevant code in scan_content() in mhbuildsbr.c looks like:

....
        while (fgets (buffer, sizeof(buffer) - 1, in)) {
            /*
             * Check for 8bit data.
             */
            if (check8bit) {
                for (cp = buffer; *cp; cp++) {
                    if (!isascii (*cp)) {
                        contains8bit = 1;
                        check8bit = 0;  /* no need to keep checking */
                    }
                    /*
                     * Check if character is ebcdic-safe.  We only check
                     * this if also checking for 8bit data.
                     */
                    if (checkebcdic && !ebcdicsafe[*cp & 0xff]) {
                        ebcdicunsafe = 1;
                        checkebcdic = 0; /* no need to keep checking */
                    }
                }
            }



=---------------------
 paul fox, pgf(_at_)foxharp(_dot_)boston(_dot_)ma(_dot_)us (arlington, ma, 
where it's 59.9 degrees)


_______________________________________________
Nmh-workers mailing list
Nmh-workers(_at_)nongnu(_dot_)org
http://lists.nongnu.org/mailman/listinfo/nmh-workers

<Prev in Thread] Current Thread [Next in Thread>
  • [Nmh-workers] application/octet-stream oddness, Paul Fox <=