MIME (Multi-purpose Internet Mail Extensions) types are an internet standard used to encode the wide variety of file types on the various computer platforms that make up the internet. MIME provides a standardized, cross-platform representation of data. World Wide Web servers and browsers use MIME types to identify the type of file that is being transferred between the two systems. Quid Pro Quo can be configured to identify a MIME type based on file's suffix. This allows you to extend the file-handling capabilities of Quid Pro Quo, which comes pre-configured for a wide variety of common internet file types.

Note that plug-in suffix mappings are not editable. They are set by the plug-in itself at Quid Pro Quo start-up time.

The MIME Configuration Dialog

To begin configuring MIME Types, open the MIME preferences panel by selecting Configure.. from the Control menu. Clicking on the MIME Mappings icon brings up the preferences panel.

In the MIME Mappings panel a file suffix is associated with a MIME type and the action that Quid Pro Quo is to perform on files of the designated type. The actions supported by this version of Quid Pro Quo are:

In the example configuration above, the files with the suffix ".html" will be sent as text files, with the MIME type "text/html".

Text

Files mapped to the Text action are simply sent as text files with no further processing. This is one of the most common actions. Typically, .html files are sent as text files. You should use the Text action for all files containing plain text without any binary formatting. Examples of text files are those of type 'TEXT' created by applications such as SimpleText or BBEdit. Do not use the Text action on binary files such as those created by word processors like Word or WordPerfect.

Binary

The Binary action sends files with no further processing on the part of the server. All files that are not text files (and do not need any server-based processing) should be sent using the Binary action. These include graphics files, such as GIF and JPEG files, application documents such as those made by Word or Excel, and Java applets. When a client requests a document that does not have an explicit MIME mapping, Quid Pro Quo uses the Binary action to send the file. When in doubt about which action to use in sending a file, it is usually best to use the Binary action.

CGI

The CGI (Common Gateway Interface) action causes Quid Pro Quo to launch an application or script to perform the processing for the client request. The CGI application or script returns a result to Quid Pro Quo, which is then relayed to the client. The Quid Pro Quo distribution includes several CGI examples written in AppleScript and C on which you can base your own CGI applications. For more information on writing and using CGIs, see the manual entry on the subject.

ACGI

The ACGI action is similar to the CGI action, but with one important difference: ACGI actions occur asynchronously (hence the 'A' in 'ACGI'). ACGI actions do not tie up the server while it waits for the CGI to complete. When a CGI request is processed, Quid Pro Quo passes control the CGI application or script, and then does nothing while waiting for the CGI to complete. With an ACGI, however, Quid Pro Quo can continue processing other client requests while waiting for the ACGI to complete. In terms of performance, ACGIs have a distinct advantage over CGIs. So why use CGIs at all? Because they solve the problem of reentrancy. That is, AppleScripts and some application CGIs are incapable of handling more than one request at a time. If these CGIs are configured to run as ACGIs, they might be asked by Quid Pro Quo to handle an incoming request while they are already handling a previous request. This would likely result in one of the two requests (or three or four requests on a busy server) to be dropped entirely. Running as a CGI solves this problem, at the cost of making every client wait for the one client request to complete.

SSI

The SSI (Server Side Includes) action allows you to create dynamic web pages. These pages are created by means of an integral pre-processor that scans outgoing HTML pages for special tags that cause Quid Pro Quo to insert environment variables such as the pages hit count, the time of day, the client network address, and a number of others. The SSI action also allows you to include entire separate files in the HTML page. You can even execute CGIs and ACGIs whose output will be inserted in-line into the HTML document. For information on creating documents for use with SSI, this manual comes with a section devoted to the subject. The Quid Pro Quo distribution also comes with several example SSI pages.

Unformatted

The Unformatted action sends a client-requested file with no processing whatsoever (not even an HTTP header is included). While Quid Pro Quo allows you to define a file suffix that will be mapped to the Unformatted action, you can also specify that the Unformatted action be taken by changing the file type of the requested file to 'RAW!'. The WebStar WWW server calls this action "raw file types". With the Unformatted action you can create your own symbolic links (loosely analogous to Macintosh aliases) on your server. For instance if you change the URL to a page, you may want to leave a reference to the new URL at the location of the old URL. The contents of the old URL file would be an HTTP header looking something like:

HTTP/1.0 302 Moved
Location: http://www.yoursite.com/newurl.html

The file type of the old URL should be changed to 'RAW!' so that when Quid Pro Quo sends the file to the client it will not prepend an HTTP header to the header that you have manually created, thus negating your header. The file type 'RAW!' overrides any other MIME mapping that may be applied to the file. For instance, the above example is an HTML document mapped to the Text action. However, since the file type is 'RAW!', the Text mapping is ignored and the file is sent with the Unformatted action.

User-Defined Actions

Quid Pro Quo actions are not limited to the built-in types. You can extend the built-in capabilities through the use of user-defined actions. These are CGI or ACGI applications or plug-ins that are configured to respond to specific URL requests. For instance, an image map user action could be defined to handle all client accesses to files ending in '.map'. To find out how to use user-defined actions, see the manual entry for the subject. Plug-in actions and suffix mappings are determined by Quid Pro Quo by polling the plug-in at start-up. The values set by the plug-in are not editable.


Send questions and comments to me, Chris Hawk

Welcome | Contents | Glossary