When converting a CGI variable into a SAF using NSAPI, Since the CGI environment variables are not available to NSAPI, you’ll retrieve them from the NSAPI parameter blocks. The table below indicates how each CGI environment variable can be obtained in NSAPI.
Table 1–6 Parameter Blocks for CGI Variables
CGI getenv() |
NSAPI |
---|---|
pblock_findval("auth-type", rq->vars); |
|
pblock_findval("auth-user", rq->vars); |
|
pblock_findval("content-length", rq->headers); |
|
pblock_findval("content-type", rq->headers); |
|
"CGI/1.1" |
|
pblock_findval( "*", rq->headers); (* is lowercase; dash replaces underscore) |
|
pblock_findval("path-info", rq->vars); |
|
pblock_findval("path-translated", rq->vars); |
|
pblock_findval("query", rq->reqpb); (GET only; POST puts query string in body data) |
|
pblock_findval("ip", sn->client); |
|
session_dns(sn) ? session_dns(sn) : pblock_findval("ip", sn->client); |
|
pblock_findval( "from", rq->headers);(not usually available) |
|
pblock_findval("auth-user", rq->vars); |
|
pblock_findval("method", req->reqpb); |
|
pblock_findval("uri", rq->reqpb); |
|
char *util_hostname(); |
|
conf_getglobals()->Vport; (as a string) |
|
pblock_findval("protocol", rq->reqpb); |
|
MAGNUS_VERSION_STRING |
|
Sun ONE-specific: | |
pblock_findval("auth-cert", rq->vars) |
|
char *session_maxdns(sn);(may be null) |
|
security_active ? "ON" : "OFF"; |
|
pblock_findval("keysize", sn->client); |
|
pblock_findval("secret-keysize", sn->client); |
|
pblock_findval( query", rq->reqpb); (GET only, POST puts query string in entity-body data) |
|
http_uri2url_dynamic("","", sn, rq); |
Your code must be thread-safe under NSAPI. You should use NSAPI functions that are thread-safe. Also, you should use the NSAPI memory management and other routines for speed and platform independence.