multimedia files over httpd (Marc Andreessen)
Date: Fri, 5 Mar 93 00:15:36 -0800
From: (Marc Andreessen)
Message-id: <>
Subject: multimedia files over httpd
X-Md4-Signature: 2a57437c7fe621084fe8cdaa610a5778
Some people using NCSA Mosaic 0.9 have noticed that they can't put
multimedia files on their own httpd servers and retrieve them
correctly with Mosaic.  What's happening in most cases is that the WWW
Daemon is prepending <PLAINTEXT> to the head of those files.

The problem lies in HTRetrieve.c, line 180:

    if (*extension == '.') {
        return    0==strcmp(".html", extension) ? WWW_HTML
                : 0==strcmp(".rtf",  extension) ? WWW_RICHTEXT
                : 0==strcmp(".txt",  extension) ? WWW_PLAINTEXT
                : 0==strcmp(".tar",  extension) ? WWW_BINARY
                : 0==strcmp(".hqx",  extension) ? WWW_BINARY
                : 0==strcmp(".Z",  extension) ? WWW_BINARY
                : WWW_PLAINTEXT;        /* Unrecognised : try plain text */
    } else {
        return WWW_PLAINTEXT;

...and line 295:

        /* Tell the client which format is to be sent */
        if (format == WWW_HTML) {
            status = read_file(soc, fd);
        } else {
            if (format==WWW_PLAINTEXT) {
                HTWriteASCII(soc, "<PLAINTEXT>\r\n");
                read_file(soc, fd);
                HTWriteASCII(soc, "<HEAD></HEAD><BODY>\r\n");
                HTSendPreformatted(soc, fd);
                HTWriteASCII(soc, "</BODY>\r\n");
            } else {
"Sorry, this document appears to be neither a plain text file nor hypertext file.\n");
"The current version of www does not yet handle multiple formats. Watch this space...\n");
                return fd;

Basically, if you hack this so it just sends back files with
unrecognized extensions (or some set of extensions that your server
would like to serve) without prepending anything, things will work.
The only gotcha I've found is that anything on the server without the
extension .txt will no longer be given a free ride as <plaintext> from
the server to the client.

An alternate solution is to put your images, sound files, etc. on your
anonymous FTP server or (shudder) your Gopher server and then point to
them at that location from your HTML documents.


Marc Andreessen
Software Development Group
National Center for Supercomputing Applications