Service Example - Netscape ENTERPRISE SERVER 6.0 - NSAPI PROGRAMMER GUIDE Manual

Nsapi
Table of Contents

Advertisement

Service Example

/* Work variables */
pb_param *path = pblock_find("path", rq->vars);
struct stat finfo;
char *npath;
int baselen;
/* If the type has already been set, don't do anything */
if(pblock_findval("content-type", rq->srvhdrs))
/* If path does not end in .html, let normal object types
baselen = strlen(path->value) - 5;
if(strcasecmp(&path->value[baselen], ".html") != 0)
/* 1 = Room to convert html to shtml */
npath = (char *) MALLOC((baselen + 5) + 1 + 1);
strncpy(npath, path->value, baselen);
strcpy(&npath[baselen], ".shtml");
/* If it's not there, don't do anything */
if(stat(npath, &finfo) == -1) {
}
/* Got it, do the switch */
FREE(path->value);
path->value = npath;
/* The server caches the stat() of the current path.
(void) request_stat_path(NULL, rq);
pblock_nvinsert("content-type", "magnus-internal/parsed-html",
return REQ_PROCEED;
}
Service Example
This section discusses a very simple
this function does is send a message in response to a client request. The message is
initialized by the
For a more complex example, see the file
which is discussed in "More Complex Service Example," on page 227.
224
Netscape Enterprise Server NSAPI Programmer's Guide • November 2001
return REQ_NOACTION;
do their job */
return REQ_NOACTION;
FREE(npath);
return REQ_NOACTION;
Update it. */
rq->srvhdrs);
init_simple_service
function called
Service
function during server initialization.
in the
service.c
All
simple_service.
directory,
examples

Advertisement

Table of Contents
loading

This manual is also suitable for:

Enterprise server 6.0

Table of Contents