httpd::mtype(n) 1.1 "Tcl Web Server"

Name

httpd::mtype - Mime types

Table Of Contents

Synopsis

Description

The package httpd::mtype provides functionality which determines the MIME type of a file and related utilities. The MIME type (e.g., text/html or image/jpeg) is used by the Document domain to dispatch out to type-specific document handlers. For example, if there is a procedure named Doc_image/jpeg then the Document domain will use that procedure to handle requests for files of that type.

Public API

Mtype path

Determines the MIME type of the file specified by path and returns it as the result of the command.

Mtype_ReadTypes file

Set a number of hardwired mappings from file extensions to mime types first and then reads the specified types file to set up more.

Mtype_Accept sock

Extract the mime-types favored by the browser making the current request on the connection sock and returns them as the result of the command. The result is a list.

Mtype_Match accept type

Compares the mime type to the list of acceptable types and return a boolean flag. If true then the type is acceptable.

Mtype_Add suffix type

Adds a mapping from the file extension suffix to the mime type to the database maintained by this package

Mtype_Reset

Clears all type mappings stored in the internal database.

Keywords

files, filesystem, mime, type, web server