![Netscape ENTERPRISE SERVER 6.1 Скачать руководство пользователя страница 228](http://html1.mh-extra.com/html/netscape/enterprise-server-6-1/enterprise-server-6-1_manual_1674653228.webp)
Service Example
228
Netscape Enterprise Server NSAPI Programmer’s Guide • April 2002 (Draft)
/* 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))
return REQ_NOACTION;
/*
If path does not end in .html, let normal object types
do their job */
baselen = strlen(path->value) - 5;
if(strcasecmp(&path->value[baselen], ".html") != 0)
return REQ_NOACTION;
/* 1 = Room to convert html to shtml */
npath = (char *) MALLOC((b 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) {
FREE(npath);
return REQ_NOACTION;
}
/* Got it, do the switch */
FREE(path->value);
path->value = npath;
/*
The server caches the stat() of the current path.
Update it. */
(void) request_stat_path(NULL, rq);
pblock_nvinsert("content-type", "magnus-internal/parsed-html",
rq->srvhdrs);
return REQ_PROCEED;
}
Service Example
This section discusses a very simple
Service
function called
simple_service.
All
this function does is send a message in response to a client request. The message is
initialized by the
init_simple_service
function during server initialization.
For a more complex example, see the file
service.c
in the
examples
directory,
which is discussed in “More Complex Service Example,” on page 231.
Содержание ENTERPRISE SERVER 6.1
Страница 1: ...NSAPI Programmer s Guide Netscape Enterprise Server Version6 1 April 2002 Draft...
Страница 18: ...Where to Find Related Information 18 Netscape Enterprise Server NSAPI Programmer s Guide April 2002 Draft...
Страница 138: ...CGI to NSAPI Conversion 138 Netscape Enterprise Server NSAPI Programmer s Guide April 2002 Draft...
Страница 214: ...NSAPI Functions in Alphabetical Order 214 Netscape Enterprise Server NSAPI Programmer s Guide April 2002 Draft...
Страница 290: ...Miscellaneous 290 Netscape Enterprise Server NSAPI Programmer s Guide April 2002 Draft...
Страница 310: ...The Netscape LDAP Schema 310 Netscape Enterprise Server NSAPI Programmer s Guide April 2002 Draft...
Страница 318: ...cinfo 318 Netscape Enterprise Server NSAPI Programmer s Guide April 2002 Draft...
Страница 324: ...Sample MIME Types File 324 Netscape Enterprise Server NSAPI Programmer s Guide April 2002 Draft...
Страница 336: ...Buffered Streams 336 Netscape Enterprise Server NSAPI Programmer s Guide April 2002 Draft...
Страница 344: ...344 Netscape Enterprise Server NSAPI Programmer s Guide April 2002 Draft...
Страница 350: ...350 Netscape Enterprise Server NSAPI Programmer s Guide April 2002 Draft...
Страница 356: ...356 Netscape Enterprise Server NSAPI Programmer s Guide April 2002 Draft...