|
CGI Variable
- Variables
Environment variables store network system information that a CGI program needed. Snaml environment variables can be accessed through env global array. For example,
set server_name $::env(SERVER_NAME)
set server_software $::env(SERVER_SOFTWARE)
- Server Information
Server information variables provide the server status. 'GATEWAY_INTERFACE' is the CGI revision of the server; 'SERVER_NAME' is the host name or IP address of the server; and'SERVER_SOFTWARE' is the name and version of server software. In additon, 'SERVER_PROTOCOL' is the name and revision of the protocol such as HTTP 1.0. Finally, 'SERVER_PORT' is the host port number
#!/usr/local/bin/snaml
__cgi "Content-type: text/html"
_html
_head
_title
_quote "Server Information"
title_
head_
_body
_pre
_quote "GATEWAY_INTERFACE = $::env(GATEWAY_INTERFACE)"
_quote "SERVER_NAME = $::env(SERVER_NAME)"
_quote "SERVER_SOFTWARE = $::env(SERVER_SOFTWARE)"
_quote "SERVER_PROTOCOL = $::env(SERVER_PROTOCOL)"
_quote "SERVER_PORT = $::env(SERVER_PORT)"
pre_
body_
html_
- Client Information
Client sends its information to the server through the environment variables. 'HTTP_USER_AGENT' stores the name of a client browser. 'HTTP_USER_FROM' is the email address of a client. Unfortunately, most browsers does not support this property. In addition, 'HTTP_ACCEPT' is a list of MIME type that a client can recognize. 'HTTP_REFERER' is the URL of a client before its visiting. The tracing information of a visitor's URL is useful for statistics.
#!/usr/local/bin/snaml
__cgi "Content-type: text/html"
_html
_head
_title
_quote "Client Information"
title_
head_
_body
_pre
_quote "HTTP_USER_AGENT = $::env(HTTP_USER_AGENT)"
_quote "HTTP_USER_FROM = $::env(HTTP_USER_FROM)"
_quote "HTTP_ACCEPT = $::env(HTTP_ACCEPT)"
_quote "HTTP_REFERER = $::env(HTTP_REFERER)"
pre_
body_
html_
- Directory Information
Directory information variables provide path information. 'DOCUMENT_ROOT' is the root directory for a web document; 'PATH_INFO' is the extra path information to a CGI program; and 'PATH_TRANSLATED' is the path that maps PATH_INFO to the root directory. Finally 'SCRIPT_NAME' is the relative path name of a CGI script.
#!/usr/local/bin/snaml
__cgi "Content-type: text/html"
_html
_head
_title
_quote "Directory Information"
title_
head_
_body
_pre
_quote "DOCUMENT_ROOT = $::env(DOCUMENT_ROOT)"
_quote "PATH_INFO = $::env(PATH_INFO)"
_quote "PATH_TRANSLATED = $::env(PATH_TRANSLATED)"
_quote "SCRIPT_NAME = $::env(SCRIPT_NAME)"
pre_
body_
html_
- Content Information
Content information variables provide the information of CGI data. Where 'QUERY_STRING' stores the query data to the CGI program. For example, http://www.neatware.com/cgi-bin/user.tcl?rayn is a query string. The string 'rayn' after the ? is the value of the env(QUERY_STRING). 'CONTENT_TYPE' is the MIME type that sends to the CGI program. And 'CONTENT_LENGTH' is the length of data to CGI.
#!/usr/local/bin/snaml
__cgi "Content-type: text/html"
_html
_head
_title
_quote "Content Information"
title_
head_
_body
_pre
_quote "QUERY_STRING = $::env(QUERY_STRING)"
_quote "CONTENT_TYPE = $::env(CONTENT_TYPE)"
_quote "CONTENT_LENGTH = $::env(CONTENT_LENGTH)"
pre_
body_
html_
-
Authentication and Identification
Authentication and Identification specify the method of authentication and the identification of user. 'AUTH_TYPE' stores the authentication method; 'REMOTE_HOST' and 'REMOTE_ADDR' are remote hostname and IP address; and 'REMOTE_USER' is user's name. Finally, 'REMOTE_IDENT' is the user name who makes request.
#!/usr/local/bin/snaml
__cgi "Content-type: text/html"
_html
_head
_title
_quote "Content Information"
title_
head_;
_body
_pre
_quote "AUTH_TYPE = $env(AUTH_TYPE)"
_quote "REMOTE_HOST = $env(REMOTE_HOST)"
_quote "REMOTE_ADDR = $env(REMOTE_ADDR)"
_quote "REMOTE_USER = $env(REMOTE_USER)"
_quote "REMOTE_IDENT = $env(REMOTE_IDENT)"
pre_
body_
html_
- Request Method
GET method makes form data contained in a URL string. POST method makes CGI program receive data as an input stream.
|
Copyright© 2000-2002, Neatware. All Rights Reserved.
|
|