next up previous contents
Next: NCSA's HTTPD Server Up: Configuration Previous: Resticting Access to

Specifying the MIME Content Type with MacHTTP

The configuration file also lets you specify up to 20 MIME Content Types. A few of the default examples are:

    TEXT    .HTML   TEXT * text/html
    BINARY  .GIF    GIFf * image/gif
    APPL    .EXE    APPL * text/html
    SCRIPT  .SCRIPT TEXT * text/html
    TEXT    .TXT    TEXT * text/plain
    TEXT    .HQX    TEXT * application/mac-binhex40
    BINARY  .MOV    MooV * video/quicktime
    BINARY  .WORD   WDBN MSWD application/msword
The format here is TYPE, them File Name Extension, Mac File Type, Creating Application, and finally MIME Content Type.
The list is checked for a match in the order: Name Extension, Mac File Type, Creating Application, and the first match determines the MIME Content Type the server returns to the client.

Apple Macintoshes normally exclusively use the Mac File Type to determine what to do with a data file. However, whilst this may be sufficient to decide which editor to start to edit a file, it wouldn't distinguish between HTML files which need a content-type of text/html and plain text files needing a content type of text/plain. Also, it wouldn't help much for files that originated on a none-Macintosh systemgif.

The first field in these configuration entries if the MacHTTP.conf command specifying that this is a definition. The different types are needed to decide what to do with the file. BINARY files are simply returned to the client. TEXT files have Carriage Returns mapped to CR/LF pairs (this is the WWW standard for text files). SCRIPT files are AppleScript files which are fed to ApplesScript and executed - they should normally return HTML as output. APPL files are Mac binaries, and are simply executed - again they should return HTML as output. See the active map section for an example of an AppleScript script with MacHTTP.

Jon Crowcroft
Wed May 10 11:46:29 BST 1995