multimedia files over httpd

Marc Andreessen (marca@ncsa.uiuc.edu)
Fri, 5 Mar 93 00:15:36 -0800


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) {
#ifdef USE_PLAINTEXT
HTWriteASCII(soc, "<PLAINTEXT>\r\n");
read_file(soc, fd);
#else
HTWriteASCII(soc, "<HEAD></HEAD><BODY>\r\n");
HTSendPreformatted(soc, fd);
HTWriteASCII(soc, "</BODY>\r\n");
#endif
} else {
HTWriteASCII(soc,
"Sorry, this document appears to be neither a plain text file nor hypertext file.\n");
HTWriteASCII(soc,
"The current version of www does not yet handle multiple formats. Watch this space...\n");
free(document_name);
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.

Cheers,
Marc

--
Marc Andreessen
Software Development Group
National Center for Supercomputing Applications
marca@ncsa.uiuc.edu