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

NAME

httpd::mtype - Mime types

TABLE OF CONTENTS

    TABLE OF CONTENTS
    SYNOPSIS
    DESCRIPTION
    Public API
    KEYWORDS
    COPYRIGHT

SYNOPSIS

package require httpd::mtype ?1.1?

Mtype path
Mtype_ReadTypes file
Mtype_Accept sock
Mtype_Match accept type
Mtype_Add suffix type
Mtype_Reset

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

COPYRIGHT

Copyright © 2003 Andreas Kupries <andreas_kupries@users.sourceforge.net>