Source Code - Netscape ENTERPRISE SERVER 6.0 - NSAPI PROGRAMMER GUIDE Manual

Nsapi
Table of Contents

Advertisement

Source Code

This example is in the
plugins/nsapi/examples
#include "nsapi.h"
#include <string.h>
#include "frame/log.h"
#ifdef __cplusplus
extern "C"
#endif
NSAPI_PUBLIC int explicit_pathinfo(pblock *pb, Session *sn, Request
*rq)
{
/* Parameter: The character to split the path by */
char *sep = pblock_findval("separator", pb);
/* Server variables */
char *ppath = pblock_findval("ppath", rq->vars);
/* Temp var */
char *t;
/* Verify correct usage */
if(!sep) {
log_error(LOG_MISCONFIG, "explicit-pathinfo", sn, rq,
"missing parameter (need root)");
/* When we abort, the default status code is 500 Server
Error */
return REQ_ABORTED;
}
/* Check for separator. If not there, don't do anything */
t = strchr(ppath, sep[0]);
if(!t)
return REQ_NOACTION;
/* Truncate path at the separator */
*t++ = '\0';
/* Assign path information */
pblock_nvinsert("path-info", t, rq->vars);
/* Normally NameTrans functions return REQ_PROCEED when they
change the path. However, we want name translation to
continue after we're done. */
return REQ_NOACTION;
}
file in the
ntrans.c
nsapi/examples/
subdirectory of the server root directory.
/* strchr */
/* log_error */
NameTrans Example
or
Chapter 6
Examples of Custom SAFs
217

Advertisement

Table of Contents
loading

This manual is also suitable for:

Enterprise server 6.0

Table of Contents