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


The protocol_status function sets the session status to indicate whether an error condition occurred. If the reason string is NULL, the server attempts to find a reason string for the given status code. If it finds none, it returns “Unknown reason.” The reason string is sent to the client in the HTTP response line. Use this function to set the status of the response before calling the function protocol_start_response.

For the complete list of valid status code constants, please refer to the file "nsapi.h" in the server distribution.


void protocol_status(Session *sn, Request *rq, int n, char *r);


void, but it sets values in the Session/Request designated by sn/rq for the status code and the reason string.


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.

int n is one of the status code constants above.

char *r is the reason string.


/* if we find extra path-info, the URL was bad so tell the *//*
 browser it was not found */if (t = pblock_findval("path-info", rq->vars)) 
protocol_status(sn, rq, PROTOCOL_NOT_FOUND, NULL);     log_error(LOG_WARN,
"function-name", sn, rq, "%s not found",        path);     
return REQ_ABORTED;}

See Also