websExpand | GoAhead WebServer API | GoAhead EMF |
Expand dollar variables in a string.
#include "webs.h" char *websExpand(webs_t wp, char *buf, char *string, int bufsize);
wp | Web server connection handle |
buf | Output buffer |
string | Input string |
len | Size of output buffer |
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:
COMPANY | Defined company name |
CONTENT_LENGTH | Length of posted content |
DBNAME | Primary database name "primary" |
DESCRIPTION | Product description |
D_OS | Operating system name |
D_PROD | Home directory for the product |
D_SOLUTION | Home directory for solution packs |
GATEWAY_INTERFACE | Version of this gateway interface |
HTTP_AUTHORIZATION | Password supplied by the browser |
HTTP_name | Where name is any key name in the browser request |
OS | Operating system |
PATH_INFO | URL path information after /form |
PATH_TRANSLATED | File system path name for URL document |
PRODUCT | Product name |
QUERY_STRING | Complete query string |
REMOTE_ADDR | Requesting browsers IP address |
REMOTE_HOST | Requesting browsers host name |
REQUEST_METHOD | Request operation type |
SERVER_HOST | Host name for this web server |
SERVER_PORT | TCP/IP port used by this web server |
SERVER_URL | URL to address the home page for this web server |
VERSION | Version number (n.n) for this product |
VERSION_FULL | Full version number (n.n.n) |
Returns the buffer supplied or dynamically allocated buffer if buffer was NULL. Return NULL on errors.
websExpand(wp, NULL, "$COMPANY $SERVER_PORT", -1);