Netscape ENTERPRISE SERVER 6.0 - NSAPI PROGRAMMER GUIDE Manual page 218

Nsapi
Table of Contents

Advertisement

NameTrans Example
#include "base/util.h"
#include "frame/protocol.h"
#include "base/shexp.h"
#ifdef __cplusplus
extern "C"
#endif
NSAPI_PUBLIC int https_redirect(pblock *pb, Session *sn, Request
*rq)
{
/* Server Variable */
char *ppath = pblock_findval("ppath", rq->vars);
/* Parameters */
char *from = pblock_findval("from", pb);
char *url = pblock_findval("url", pb);
char *alt = pblock_findval("alt", pb);
/* Work vars */
char *ua;
/* Check usage */
if((!from) || (!url)) {
}
/* Use wildcard match to see if this path is one we should
if(shexp_cmp(ppath, from) != 0)
/* Sigh. The only way to check for SSL capability is to
if(request_header("user-agent", &ua, sn, rq) == REQ_ABORTED)
/* The is_mozilla function checks for Mozilla version 0.96
if(util_is_mozilla(ua, "0", "96")) {
}
/* No match. Old client. */
218
Netscape Enterprise Server NSAPI Programmer's Guide • November 2001
log_error(LOG_MISCONFIG, "https-redirect", sn, rq,
"missing parameter (need from, url)");
return REQ_ABORTED;
redirect */
return REQ_NOACTION;
check UA */
return REQ_ABORTED;
or greater */
/* Set the return code to 302 Redirect */
protocol_status(sn, rq, PROTOCOL_REDIRECT, NULL);
/* The error handling functions use this to set the
Location: */
pblock_nvinsert("url", url, rq->vars);
return REQ_ABORTED;
/* is_mozilla */
/* protocol_status */
/* shexp_cmp */
/* no match */

Advertisement

Table of Contents
loading

This manual is also suitable for:

Enterprise server 6.0

Table of Contents