You may have a need to convert a CGI variable into an SAF using NSAPI. Since the CGI environment variables are not available to NSAPI, you retrieve them from the NSAPI parameter blocks. The table below indicates how each CGI environment variable can be obtained in NSAPI.
Keep in mind that 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.
Table 1–5 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); |
|
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); |
|
system_version() |
|
Sun Java System-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); |
|
protocol_uri2url_dynamic("","", sn, rq); |