[ Previous ] [ Contents ] [ Index ] [ Next ]



Mark the end of the headers


    int Ns_ConnFlushHeaders(
    Ns_Conn *conn,
    int status


The Ns_ConnFlushHeaders functions returns a single blank line that signifies the end of the headers. It also sets the state of the connection from header buffering mode to immediate sending of data to the client. Before this function is called, any headers are not actually sent to the client but instead are buffered in the Ns_Conn structure to avoid the cost of sending the headers in individual network packets.

The status is a standard error code such as 403 for access denied or 200 for OK. Returns NS_OK or NS_ERROR.

This function is normally required just before sending content to the client.


    /* A simple Hello request function. */
    MyHello(Ns_Conn *conn, void *ctx)
    	char hello[] = "hello";
    	int len;
    	len = strlen(hello);
    	Ns_ConnSetRequiredHeaders(conn, "text/plain", len);
    	Ns_ConnFlushHeaders(conn, 200);
    	return Ns_ConnWrite(conn, hello, len);

Top of Page

[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright © 1998-99 America Online, Inc.