Oracle iPlanet Web Proxy Server 4.0.14 NSAPI Developer's Guide

protocol_status

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 the server finds no string, 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, refer to the nsapi.h file in the server distribution.

Syntax

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

Returns

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

Parameters

Session *sn identifies the Session structure.

Request *rq identifies the Request structure.

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

int n is one of the status code constants above.

char *r is the reason string.

Example

/* 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

protocol_start_response