JavaScript语言参考手册      
JavaScript手册
【目录】 【上一页】 【下一页】 【索引】

ssjs_getCGIVariable

Returns the value of the specified environment variable set in the server process, including some CGI variables.

服务器端函数
实现版本Netscape Server 3.0

语法

ssjs_getCGIVariable(varName)

参数

varNameA string containing the name of the environment variable to retrieve.

描述

ssjs_getCGIVariable lets you access the environment variables set in the server process, including the CGI variables listed in 表 13.2.

表 13.2 CGI variables accessible through ssjs_getCGIVariable  
Variable 描述
AUTH_TYPEThe authorization type, if the request is protected by any type of authorization. Netscape web servers support HTTP basic access authorization. Example value: basic
HTTPSIf security is active on the server, the value of this variable is ON; otherwise, it is OFF. Example value: ON
HTTPS_KEYSIZEThe number of bits in the session key used to encrypt the session, if security is on. Example value: 128
HTTPS_SECRETKEYSIZEThe number of bits used to generate the server's private key. Example value: 128
PATH_INFOPath information, as sent by the browser. Example value: /cgivars/cgivars.html
PATH_TRANSLATEDThe actual system-specific pathname of the path contained in PATH_INFO. Example value: /usr/ns-home/myhttpd/js/samples/cgivars/cgivars.html
QUERY_STRINGInformation from the requesting HTML page; if "?" is present, the information in the URL that comes after the "?". Example value: x=42
REMOTE_ADDRThe IP address of the host that submitted the request. Example value: 198.93.95.47
REMOTE_HOSTIf DNS is turned on for the server, the name of the host that submitted the request; otherwise, its IP address. Example value: www.netscape.com
REMOTE_USERThe name of the local HTTP user of the web browser, if HTTP access authorization has been activated for this URL. Note that this is not a way to determine the user name of any person accessing your program. Example value: ksmith
REQUEST_METHODThe HTTP 方法 associated with the request. An application can use this to determine the proper response to a request. Example value: GET
SCRIPT_NAMEThe pathname to this page, as it appears in the URL. Example value: cgivars.html
SERVER_NAMEThe hostname or IP address on which the JavaScript application is running, as it appears in the URL. Example value: piccolo.mcom.com
SERVER_PORTThe TCP port on which the server is running. Example value: 2020
SERVER_PROTOCOLThe HTTP protocol level supported by the client's software. Example value: HTTP/1.0
SERVER_URLThe URL that the user typed to access this server. Example value: https://piccolo:2020

If you supply an argument that isn't one of the CGI variables listed in n, the runtime engine looks for an environment variable by that name in the server environment. If found, the runtime engine returns the value; otherwise, it returns null. For example, the following code assigns the value of the standard CLASSPATH environment variable to the JavaScript variable classpath:

classpath = ssjs_getCGIVariable("CLASSPATH");


【目录】 【上一页】 【下一页】 【索引】

返回页面顶部

JavaScript中文手册 站长在线 整理