CGI to NSAPI Conversion
Chapter
4
Creating Custom SAFs
131
•
Remove existing
content-type
from
rq->srvhdrs
. Insert correct
content-type
in
rq->srvhdrs
.
•
Create any other headers in
rq->srvhdrs
.
•
Call
protocol_status
to set HTTP response status.
•
Call
protocol_start_response
to send HTTP response and headers.
•
Generate and send data to the client using
net_write
.
•
Return
REQ_PROCEED
if successful,
REQ_EXIT
on write error,
REQ_ABORTED
on
other failures.
Error SAFs
•
Purpose: Respond to an HTTP status error condition.
•
The Error SAF is only called if each of the optional parameters
code
and
reason
specified in the directive in
obj.conf
match the current error.
•
Error SAFs do the same as Service SAFs, but only in response to an HTTP
status error condition.
AddLog SAFs
•
Purpose: Log the transaction to a log file.
•
AddLog
SAFs can use any data available in
pb
,
sn
, or
rq
to log this transaction.
•
Return
REQ_PROCEED
.
CGI to NSAPI Conversion
You may have a need to convert 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.
Keep in mind that your code must be thread-safe under NSAPI. You should use
NSAPI functions which are thread-safe. Also, you should use the NSAPI memory
management and other routines for speed and platform independence.
Summary of Contents for ENTERPRISE SERVER 6.0
Page 1: ...NSAPI Programmer s Guide Netscape Enterprise Server Version6 0 November 2001...
Page 134: ...CGI to NSAPI Conversion 134 Netscape Enterprise Server NSAPI Programmer s Guide November 2001...
Page 306: ...cinfo 306 Netscape Enterprise Server NSAPI Programmer s Guide November 2001...
Page 312: ...Sample MIME Types File 312 Netscape Enterprise Server NSAPI Programmer s Guide November 2001...
Page 324: ...Buffered Streams 324 Netscape Enterprise Server NSAPI Programmer s Guide November 2001...
Page 332: ...332 Netscape Enterprise Server NSAPI Programmer s Guide November 2001...
Page 340: ...340 Netscape Enterprise Server NSAPI Programmer s Guide November 2001...
Page 346: ...346 Netscape Enterprise Server NSAPI Programmer s Guide November 2001...
Page 352: ...352 Netscape Enterprise Server NSAPI Programmer s Guide November 2001...