Sun Java System Web Server 6.1 SP11 NSAPI Programmer's Guide

protocol_start_response

The protocol_start_response function initiates the HTTP response for a specified session and request. If the protocol version is HTTP/0.9, the function does nothing, because that version has no concept of status. If the protocol version is HTTP/1.0, the function sends a status line followed by the response headers. Use this function to set up HTTP and prepare the client and server to receive the body (or data) of the response.

Syntax

int protocol_start_response(Session *sn, Request *rq);

Returns

The constant REQ_PROCEED if the operation succeeded, in which case you should send the data you were preparing to send.

The constant REQ_NOACTION if the operation succeeded but the request method was HEAD, in which case no data should be sent to the client.

The constant REQ_ABORTED if the operation did not succeed.

Parameters

Session *sn is the Session.

Request *rq is the Request.

The Session and Request parameters are the same as the ones passed into your SAF.

Example

/* A noaction response from this function means the request 
was HEAD */if (protocol_start_response(sn, rq) == REQ_NOACTION) 
filebuf_close(groupbuf);  /* close our file*/    return REQ_PROCEED;}

See Also

protocol_status