Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

ns_getmimetype(3aolserv) [debian man page]

Ns_Mime(3aolserver)					   AOLserver Library Procedures 				       Ns_Mime(3aolserver)

__________________________________________________________________________________________________________________________________________________

NAME
Ns_GetMimeType - Return the MIME type of a file SYNOPSIS
#include "ns.h" char * Ns_GetMimeType(char *file) _________________________________________________________________ DESCRIPTION
Ns_GetMimeType(file) The Ns_GetMimeType function uses the extension of file and looks up the associated MIME type stored internally in the server. Case is ignored. The return value is of the form "text/html". AOLserver has a set of predefined file extension to MIME type associations. You can add to these associations by defining file extension to MIME type associations in the server configuration file in the ns/mimetypes section. If you define a file extension that already exists in the server, that file extension and MIME type association will be replaced with yours. If no MIME type association exists for a particular file extension, or there is no file extension, the default and noextension MIME types are returned, respectively. These default to "*/*" but can be set in the server configuration file. Here is an example ns/mimetypes section from the server configuration file: ns_section "ns/mimetypes" ns_param ".doc" "application/msword" ns_param ".ppt" "application/vnd.ms-powerpoint" ns_param ".xls" "application/vnd.ms-excel" ns_param ".cab" "application/mscabinet" ns_param ".frl" "application/x-perfpro" ns_param ".max" "application/vviewer" ns_param ".mif" "application/x-mif" ns_param ".frz" "application/x-dffill" ns_param ".asvg" "image/svg-xml" ns_param ".asvgz" "image/svg-xml" ns_param ".svg" "image/svg-xml" ns_param ".svgz" "image/svg-xml" ns_param default "*/*" ns_param noextension "*/*" SEE ALSO
nsd(1), info(n) KEYWORDS
AOLserver 4.0 Ns_Mime(3aolserver)

Check Out this Related Man Page

Ns_ConnType(3aolserver) 				   AOLserver Library Procedures 				   Ns_ConnType(3aolserver)

__________________________________________________________________________________________________________________________________________________

NAME
Ns_ConnGetType, Ns_ConnSetType - Routines to manage the HTTP response type SYNOPSIS
#include "ns.h" char * Ns_ConnGetType(conn) void Ns_ConnSetType(conn, type) ARGUMENTS
Ns_Conn conn (in) Pointer to open connection. char *type (in) Character string with response mimetype. _________________________________________________________________ DESCRIPTION
These routines both manage the eventual content-type header which is generated by a later call to Ns_ConnFlush or Ns_ConnFlushDirect as well as manage the appropriate character encoding for text output types. char *Ns_ConnGetType(conn) Return the current HTTP mime type (e.g., "text/html; charset=iso-8859-1") or NULL if no type has yet been set. void Ns_ConnSetType(conn, type) Sets the mimetype of the response to the given type. A later call to Ns_ConnFlush will include a header of the form content-type: type when generating the response. CHARSETS AND ENCODINGS
For text types, a call to Ns_ConnSetType can also include an optional "charset=" attribute. If no charset is specified, the server will append a default charset if specified as the outputcharset server configuration variable. With a given or automatically appended charset for text types, the server will then set the output encoding to the cooresponding Tcl_Encod- ing, for example, mapping the charset "iso-8859-1" to the Tcl_Encoding equivalent "iso8859-1". All text later sent via Ns_ConnFlush will be first encoded using the determined Tcl_Encoding (calls to Ns_ConnFlushDirect will bypass this encoding step). See the man pages on Ns_GetCharsetEncoding for details on how these mappings are configured. The charset modification feature was added in later versions of AOLserver to support legacy code which may have been sprinkled with direct calls to set text types without specifying the charset, e.g., calls such as: ns_return 200 text/html "<body>hello</body>" EXAMPLES
The following example demonstrates sending Japanese character data. In this case, assume "utf8string" contains a series of UTF-8 bytes with various Japanese characters. The call to Ns_ConnSetType will setup the appropriate "shiftjis" output Tcl_Encoding to match the given "shift_jis" charset: Ns_ConnSetStatus(conn, 200); Ns_ConnSetType(conn, "text/html; charset=shift_jis"); Ns_ConnFlushDirect(conn, utf8string, -1, 0); The following demonstrates the behavior of the default server charset encoding. Assume the following is set in the config file: ns_section ns/server/serverName ns_param outputcharset iso-8859-1 In this case, a call to Ns_ConnSetType(conn, "text/html") without a specific charset would be modified to include "charset=iso-8859-1". Based on this modification, the output encoding would be set to the "iso8859-1" Tcl_Encoding. SEE ALSO
Ns_ConnGetType(3), Ns_ConnSetType(3), Ns_ConnFlush(3), Ns_ConnFlushDirect(3), Ns_ConnSetRequiredHeaders(3), Ns_ConnQueueHeaders(3), Ns_GetCharsetEncoding(3), Ns_GetTypeEncoding(3), ns_conn(n) KEYWORDS
connectionn, response, status, encoding, charset AOLserver 4.0 Ns_ConnType(3aolserver)
Man Page