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

Ns_ConnFlushHeaders

Overview

Mark the end of the headers

Syntax

    int Ns_ConnFlushHeaders(
    	Ns_Conn			*conn,
    	int			 status
    );

Description

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.

Example

    /* A simple Hello request function. */
    int
    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 © 1996 America Online, Inc.