websExpand GoAhead WebServer API GoAhead EMF

Synopsis

Expand dollar variables in a string.

Prototype

 #include "webs.h" 

 char_t *websExpand
     (webs_t wp, char_t *buf, char_t *string, int bufsize); 

Parameters

wp Web server connection handle
buf Output buffer
string Input string
len Size of output buffer

Description

The websExpand procedure can be used to expand all dollar variables. These include all the standard CGI variables, extended GoAhead WebServer variables and all current per request variables. In addition to the standard set below, all request header variables are stored as "HTTP_name" where name is request header keyword mapped to lower case. If a particular dollar variable is not found, the original text for that variable is unchanged.

If the buffer is NULL, the expanded string is returned in a dynamically allocated buffer. Use bfree to free the buffer when you are finished.

The standard variable set includes:

COMPANYDefined company name
CONTENT_LENGTHLength of posted content
DBNAMEPrimary database name "primary"
DESCRIPTIONProduct description
D_OSOperating system name
D_PRODHome directory for the product
D_SOLUTIONHome directory for solution packs
GATEWAY_INTERFACEVersion of this gateway interface
HTTP_AUTHORIZATION Password supplied by the browser
HTTP_name Where name is any key name in the browser request
OSOperating system
PATH_INFOURL path information after /form
PATH_TRANSLATEDFile system path name for URL document
PRODUCTProduct name
QUERY_STRINGComplete query string
REMOTE_ADDRRequesting browsers IP address
REMOTE_HOSTRequesting browsers host name
REQUEST_METHODRequest operation type
SERVER_HOSTHost name for this web server
SERVER_PORTTCP/IP port used by this web server
SERVER_URLURL to address the home page for this web server
VERSIONVersion number (n.n) for this product
VERSION_FULLFull version number (n.n.n)

Return Value

Returns the buffer supplied or dynamically allocated buffer if buffer was NULL. Return NULL on errors.

Example

 
websExpand(wp, NULL, "$COMPANY $SERVER_PORT", -1); 

Stability Classification

Stable.

See Also

bfree