![]() | ![]() | Web Development |
As HTTP servers and Web clients exchange data, the HTTP protocol sends a series of header fields containing information about the data being transferred over the Web. These header fields can, in turn, be passed to any program on your HTTP server. Because the information in these variables can be useful in your Prolifics Web application, Prolifics converts some of these header fields to global variables that can be accessed through JPL procedures or C functions.
An HTTP header field has a corresponding Prolifics HTTP variable. The Prolifics variable name begins with @cgi_ followed by the HTTP field name in lower case. The Prolifics HTTP variables are read-only and are automatically reset on each GET or POST of a Prolifics screen. Because Prolifics updates these variables automatically, copy their values elsewhere if you need them for a subsequent POST.
Common uses of the HTTP variables include:
cgi_server_name and @cgi_script_name.
cgi_http_referer.
cgi_http_accept.
For example, this JPL procedure builds a URL for a link with @ A Prolifics Gallery sample entitled HTTP Variables is accessible from the Web application server at:
cgi_server_name and @cgi_script_name.
proc build_link
// This procedure sets dynamic label's
// default_link propertyhome->default_link = "http:://" ## \
@cgi_server_name ## \
@cgi_script_name ## "/home.scr"
return 0http://server-name/cgi-bin/jwsamp/main
Definitions | ![]() |
cgi_auth_type
cgi_content_length
POST is used to submit data back to the server.
cgi_content_type
POST is used to submit data back to the server. For Prolifics, this variable is set to:
application/x-www-form-urlencoded
The basic MIME types are listed in the following table:
cgi_gateway_interface
CGI/version-number
A sample value would be:
CGI/1.1
cgi_http_accept
type/subtype
You can use the contents of this variable to determine which image formats a browser can accept. For example, Netscape 2.x includes the following string, to indicate that it can display GIF, XBM, JPEG and Progressive JPEG images:
image/gif, image/x-xbitmap, image/jpeg, image/pjpeg
cgi_http_cookie
cgi_http_referer
For Prolifics applications, this information is only useful on GET events. If the user enters a Prolifics application from elsewhere, for example from another Web site, this variable will specify that location, which can then be logged if desired.
@cgi_http_user_agent
software/version comments
You can determine the format for a particular browser only by experimentation. For example, the value sent from Netscape 2.02 running on a Windows 95 PC is:
Mozilla/2.02 (Win95;I)
cgi_path_info
Prolifics uses this information to determine which Prolifics screen to open. For the example, this variable would be:
/vbiz/vidlist.scr
cgi_path_translated
DOCROOT, to the path specified in @cgi_path_info.
If the server's DOCROOT directory is /usr/local/htdocs, the variable would have the following value for the screen listed in the example:
/usr/local/htdocs/vbiz/vidlist.scr
cgi_query_string
start=top
For more information on URL encoding, refer to "Encoding Parameters in the URL."
cgi_remote_addr
cgi_remote_host
cgi_remote_ident
cgi_remote_user
cgi_request_method
GET or POST. The GET method is used when the user enters a specific URL or activates a hyperlink. The POST method is used when the user submits a form. Using this variable, you can choose which portions of your code to execute for each method.
cgi_script_name
/cgi-bin/webdev
cgi_server_name
vbiz.com.
cgi_server_port
This is 123 in the example. Port numbers are useful if there are multiple servers running on the same machine, each calling the same Prolifics executable.
cgi_server_protocol
protocol/version-number
A sample value for this variable would be:
HTTP/1.0
cgi_server_software
software-name/version
The following examples are typical values:
NCSA/1.5
Netscape-Communications/1.1