Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

ns_connqueueheaders(3aolserv) [debian man page]

Ns_ConnQueueHeaders(3aolserver) 			   AOLserver Library Procedures 			   Ns_ConnQueueHeaders(3aolserver)

__________________________________________________________________________________________________________________________________________________

NAME
Ns_ConnQueueHeaders, Ns_ConnFlushHeaders - Routines to construct send HTTP response headers SYNOPSIS
#include "ns.h" void Ns_ConnFlushHeaders(conn, status) void Ns_ConnQueueHeaders(conn, status) ARGUMENTS
Ns_Conn conn (in) Pointer to open connection. int status (in) HTTP response status. _________________________________________________________________ DESCRIPTION
These function format headers pending in the outputheaders Ns_Set 0fRtto indicatenendsofoheaders.ture to be sent to the client. The head- ers d0fR separators betweeneheaderTkey:evalueepairs andhattrailing status code (e.g., "HTTP/1.1 200 OK") is formatted as a single string with int Ns_ConnFlushHeaders(conn) This routine constructs the headers and then attempts to send them immediately to the client. The result is either NS_OK if the content was sent, NS_ERROR otherwise. void Ns_ConnQueueHeaders(conn) This routine constructs the headers as with Ns_ConnFlushHeaders but does not send the data to the client. Instead, the resulting headers string is stored in an internal buffer to be sent later on the first call to Ns_ConnSend. Delaying the flush of the content helps increase performance by providing the opportunity to combine the headers and content responses into a single system call. Note that higher level routines which generate complete responses such as the Ns_ConnReturn routines or Ns_ConnFlush call Ns_ConnQueueHead- ers automatically as needed. Only custom code which constructs headers manually and sends content directly must include a call to Ns_Con- nQueueHeaders or Ns_ConnFlushHeaders before generating the output content. EXAMPLES
The following example demonstrates a simple response. In this case, the headers are queued and sent with the small "hello" message on the call to Ns_ConnPuts which internally calls Ns_ConnSend: Ns_ConnSetRequiredHeaders(conn, "text/plain", 5); Ns_ConnQueueHeaders(conn, 200); Ns_ConnPuts(conn, "hello"); SEE ALSO
Ns_ConnSetHeaders(3), Ns_ConnSend(3) KEYWORDS
connection, headers AOLserver 4.0 Ns_ConnQueueHeaders(3aolserver)

Check Out this Related Man Page

Ns_ConnSetHeaders(3aolserver)				   AOLserver Library Procedures 			     Ns_ConnSetHeaders(3aolserver)

__________________________________________________________________________________________________________________________________________________

NAME
Ns_ConnCondSetHeaders, Ns_ConnSetExpiresHeader, Ns_ConnSetHeaders, Ns_ConnSetLastModifiedHeader, Ns_ConnSetLengthHeader, Ns_ConnSetRe- quiredHeaders - Routines to manage response headers SYNOPSIS
#include "ns.h" void Ns_ConnCondSetHeaders(conn, key, value) void Ns_ConnSetExpiresHeader(conn, expires) void Ns_ConnSetHeaders(conn, key, value) void Ns_ConnSetLastModifiedHeader(conn, mtime) void Ns_ConnSetLengthHeader(conn, length) void Ns_ConnSetRequiredHeaders(conn, type, length) void Ns_ConnSetTypeHeader(conn, type) ARGUMENTS
Ns_Conn conn (in) Pointer to open connection. char *expires(in) Pointer to string to construct an expires header. char *key (in) Pointer to string key for a header. int length (in) Integer length of output content to construct a content-length header. time_t mtime (in) Modification time stamp to construct a last-modified header. int status (in) HTTP result status code. char *type (in) Pointer to mimetype string to construct a content-type header. char *value (in) Pointer to a string value for a header. _________________________________________________________________ DESCRIPTION
These functions manage the output headers eventually sent through the given open connection to a client. They operate by modifying the outputheaders Ns_Set of the connection Ns_Conn structure. Headers can be modified until they are queued or sent directly via the Ns_Con- nQueueHeaders or Ns_ConnFlushHeaders routines. It is possible to modify the outputheaders directly although use of these functions is pre- ferred for consistancy. Note that higher level output routines such as Ns_ConnFlush or the various Ns_ConnReturn routines normally generate all the headers neces- sary for a given response. These routines are normally only necessary for specialized applications which output additional specific head- ers or specialized request procedures which do not use the higher level output routines. void Ns_ConnCondSetHeaders(conn, key, value) Append an output header of the form key: value only if the header does not already exist in the outputheaders set. void Ns_ConnSetExpiresHeader(conn, expires) This routine is equivalent to Ns_ConnSetHeaders(conn, "Expires", expires). Note that the exires parameter is treated as a string, not a timestamp. A timestamp can be constructed with the Ns_HttpTime routine. void Ns_ConnSetHeaders(conn, key, value) Append a header of the form key: value to the outputheaders. This routine will append a new, possibly duplicate, header regardless of whether a matching header already exists in the outputheaders. void Ns_ConnSetLastModifiedHeader(conn, mtime) This routine appends a last-modified header if one does not already exists, formatting the given modification time as a proper HTTP timestamp with the Ns_HttpTime routine. void Ns_ConnSetLengthHeader(conn, length) This routine appends a content-length: length header, formatting the given integer length as a string. This routine will also record the response length internally in the conn structure so that it can be later retrieved via the Ns_ConnResponseLength routine, for example, as part of a post-connection logging callback. void Ns_ConnSetRequiredHeaders(conn, type, length) This routine appends the basic headers normally required for a proper HTTP transaction. These include mime-version, date, and server as well as the content-type: type and content-length: length headers for the given arguments. If type is NULL or length is less than zero, the corresponding headers will not be appended. This routine is often the only header construction routine neces- sary for request procedures which construct headers manually instead of calling routines such as Ns_ConnFlush which handle header construction and queueing automatically. void Ns_ConnSetTypeHeader(conn, type) This routine is equivalent to Ns_ConnSetHeaders(conn, "content-type", type). SEE ALSO
Ns_ConnQueueHeaders(3), Ns_ConnFlushHeaders(3), Ns_ConnFlush(3) KEYWORDS
headers, response AOLserver 4.0 Ns_ConnSetHeaders(3aolserver)
Man Page