Ns_ConnReturnHtml3aolserver
Routines to generate simple single-buffer responses
Part of Ns_ConnReturnData(3aolserver).
Usage
#include "ns.h" int Ns_ConnReturnAdminNotice(conn, status, title, msg) int Ns_ConnReturnData(conn, status, data, len, type) int Ns_ConnReturnCharData(conn, status, data, len, type) int Ns_ConnReturnHtml(conn, status, msg, len) int Ns_ConnReturnNotice(conn, status, title, msg)
Arguments
- Ns_Conn conn (in)
-
Pointer to open connection.
- int status (in)
-
HTTP response status code.
- char *type (in)
-
Output content type.
- char *title (in)
-
Pointer to HTML page title string.
- int len (in)
-
Length of content buffer.
- char *data (in)
-
Pointer to content buffer.
- char *msg (in)
-
Pointer to HTML message buffer.
Overview
These routines are used to generate complete responses, including headers, status codes, content types, and the requested data. They all return a status code which is NS_OK if the response was sent or NS_ERROR if an underlying call to sent the content failed.
- int
Ns_ConnReturnAdminNotice(conn, status, title, msg) -
This routine is equivalent to
Ns_ConnReturnNotice. In prior versions, it would format a slightly different response which was later considered inconsequential.
- int
Ns_ConnReturnData(conn, status, data, len, type) -
Generates a reponse with the given HTTP status including a content-type header with the given type. Content pointed to by the data argument of length len is then sent without any modification via an underlying call to
Ns_ConnFlushDirect.
- int
Ns_ConnReturnCharData(conn, status, data, len, type) -
Generates a response as with
Ns_ConnReturnDataexcept that the given content pointed to by data is assumed to be a text stream which is output encoded using the appropriate Tcl_Encoding based on the given type mimetype and possibly gzip compressed via an underlying call toNs_ConnFlush.
- int
Ns_ConnReturnHtml(conn, status, msg, len) -
This is equivalent to
Ns_ConnReturnCharData(conn, status, msg, len, "text/html").
- int
Ns_ConnReturnNotice(conn, status, title, msg) -
Constructs a basic HTML response and sends it via
Ns_ConnReturnHtml. The title string is placed both in the <head> portion as well as an <h2> tag in the <body> portion of the document. If the title is NULL, it defaults to the string "Server Message". The msg string, if not NULL, follows the body and is copied unaltered. This routine is useful for generating very basic responses. For example, it is used by the various builtin reponse routines such asNs_ConnReturnUnauthorized.
Keywords
connnection, encoding, response
Releases
Unchanged in 5 releases since Debian 5.0 (Lenny).