Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

ns_connsetstatus(3aolserv) [debian man page]

Ns_ConnStatus(3aolserver)				   AOLserver Library Procedures 				 Ns_ConnStatus(3aolserver)

__________________________________________________________________________________________________________________________________________________

NAME
Ns_ConnGetStatus, Ns_ConnSetStatus - Routines to manage the HTTP response status SYNOPSIS
#include "ns.h" int Ns_ConnGetStatus(conn) void Ns_ConnSetStatus(conn, status) ARGUMENTS
Ns_Conn conn (in) Pointer to open connection. int status (in) Integer HTTP status code. _________________________________________________________________ DESCRIPTION
These routines manage the HTTP response code sent to the client in a later call to Ns_ConnFlush or Ns_ConnFlushDirect. Higher level rou- tines such as the Ns_ConnReturn functions normally call these routines automatically using standard HTTP status codes and the Ns_ConnQueue- Headers routine can be used to set the status code for lower level code which bypasses Ns_ConnFlush. int Ns_ConnGetStatus(conn) Return the current HTTP status to be sent. int Ns_ConnSetStatus(conn, status) Set the status code to be sent in the response, for example, 200 for a normal "OK" response. A later call to Ns_ConnFlush will con- struct the appropriate HTTP response including the given status with the cooresponding string status code. EXAMPLES
The following example demonstrates setting an odd status code followed by a call to Ns_ConnFlushDirect to send some data: Ns_ConnSetStatus(conn, 600); Ns_ConnSetType(conn, "text/plain"); Ns_ConnFlushDirect(conn, "hello", 5, 0); The following should provide similar results: Ns_ConnSetRequiredHeaders(conn, "text/plain", 5); Ns_ConnQueueHeaders(conn, 600); Ns_ConnPuts(conn, "hello"); Ns_ConnClose(conn); SEE ALSO
Ns_ConnGetType(3), Ns_ConnSetType(3), Ns_ConnFlush(3), Ns_ConnFlushDirect(3), Ns_ConnSetRequiredHeaders(3), Ns_ConnQueueHeaders(3), ns_conn(n) KEYWORDS
connectionn, response, status AOLserver 4.0 Ns_ConnStatus(3aolserver)

Check Out this Related 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)
Man Page