source: MondoRescue/branches/2.2.9/mindi-busybox/docs/cgi/env.html@ 2725

Last change on this file since 2725 was 2725, checked in by Bruno Cornec, 13 years ago
  • Update mindi-busybox to 1.18.3 to avoid problems with the tar command which is now failing on recent versions with busybox 1.7.3
File size: 5.6 KB
Line 
1<html><head><title>CGI Environment Variables</title></head><body><h1><img alt="" src="env_files/CGIlogo.gif"> CGI Environment Variables</h1>
2<hr>
3
4<p>
5
6In order to pass data about the information request from the server to
7the script, the server uses command line arguments as well as
8environment variables. These environment variables are set when the
9server executes the gateway program. </p><p>
10
11</p><hr>
12<h2>Specification</h2>
13
14 <p>
15The following environment variables are not request-specific and are
16set for all requests: </p><p>
17
18</p><ul>
19<li> <code>SERVER_SOFTWARE</code> <p>
20
21 The name and version of the information server software answering
22 the request (and running the gateway). Format: name/version </p><p>
23
24</p></li><li> <code>SERVER_NAME</code> <p>
25 The server's hostname, DNS alias, or IP address as it would appear
26 in self-referencing URLs. </p><p>
27
28</p></li><li> <code>GATEWAY_INTERFACE</code> <p>
29 The revision of the CGI specification to which this server
30 complies. Format: CGI/revision</p><p>
31
32</p></li></ul>
33
34<hr>
35
36The following environment variables are specific to the request being
37fulfilled by the gateway program: <p>
38
39</p><ul>
40<li> <a name="protocol"><code>SERVER_PROTOCOL</code></a> <p>
41 The name and revision of the information protcol this request came
42 in with. Format: protocol/revision </p><p>
43
44</p></li><li> <code>SERVER_PORT</code> <p>
45 The port number to which the request was sent. </p><p>
46
47</p></li><li> <code>REQUEST_METHOD</code> <p>
48 The method with which the request was made. For HTTP, this is
49 "GET", "HEAD", "POST", etc. </p><p>
50
51</p></li><li> <code>PATH_INFO</code> <p>
52 The extra path information, as given by the client. In other
53 words, scripts can be accessed by their virtual pathname, followed
54 by extra information at the end of this path. The extra
55 information is sent as PATH_INFO. This information should be
56 decoded by the server if it comes from a URL before it is passed
57 to the CGI script.</p><p>
58
59</p></li><li> <code>PATH_TRANSLATED</code> <p>
60 The server provides a translated version of PATH_INFO, which takes
61 the path and does any virtual-to-physical mapping to it. </p><p>
62
63</p></li><li> <code>SCRIPT_NAME</code> <p>
64 A virtual path to the script being executed, used for
65 self-referencing URLs. </p><p>
66
67</p></li><li> <a name="query"><code>QUERY_STRING</code></a> <p>
68 The information which follows the ? in the <a href="http://www.ncsa.uiuc.edu/demoweb/url-primer.html">URL</a>
69 which referenced this script. This is the query information. It
70 should not be decoded in any fashion. This variable should always
71 be set when there is query information, regardless of <a href="http://hoohoo.ncsa.uiuc.edu/cgi/cl.html">command line decoding</a>. </p><p>
72
73</p></li><li> <code>REMOTE_HOST</code> <p>
74 The hostname making the request. If the server does not have this
75 information, it should set REMOTE_ADDR and leave this unset.</p><p>
76
77</p></li><li> <code>REMOTE_ADDR</code> <p>
78 The IP address of the remote host making the request. </p><p>
79
80</p></li><li> <code>AUTH_TYPE</code> <p>
81 If the server supports user authentication, and the script is
82 protects, this is the protocol-specific authentication method used
83 to validate the user. </p><p>
84
85</p></li><li> <code>REMOTE_USER</code> <p>
86 If the server supports user authentication, and the script is
87 protected, this is the username they have authenticated as. </p><p>
88</p></li><li> <code>REMOTE_IDENT</code> <p>
89 If the HTTP server supports RFC 931 identification, then this
90 variable will be set to the remote user name retrieved from the
91 server. Usage of this variable should be limited to logging only.
92 </p><p>
93
94</p></li><li> <a name="ct"><code>CONTENT_TYPE</code></a> <p>
95 For queries which have attached information, such as HTTP POST and
96 PUT, this is the content type of the data. </p><p>
97
98</p></li><li> <a name="cl"><code>CONTENT_LENGTH</code></a> <p>
99 The length of the said content as given by the client. </p><p>
100
101</p></li></ul>
102
103
104<a name="headers"><hr></a>
105
106In addition to these, the header lines received from the client, if
107any, are placed into the environment with the prefix HTTP_ followed by
108the header name. Any - characters in the header name are changed to _
109characters. The server may exclude any headers which it has already
110processed, such as Authorization, Content-type, and Content-length. If
111necessary, the server may choose to exclude any or all of these
112headers if including them would exceed any system environment
113limits. <p>
114
115An example of this is the HTTP_ACCEPT variable which was defined in
116CGI/1.0. Another example is the header User-Agent.</p><p>
117
118</p><ul>
119<li> <code>HTTP_ACCEPT</code> <p>
120 The MIME types which the client will accept, as given by HTTP
121 headers. Other protocols may need to get this information from
122 elsewhere. Each item in this list should be separated by commas as
123 per the HTTP spec. </p><p>
124
125 Format: type/subtype, type/subtype </p><p>
126
127
128</p></li><li> <code>HTTP_USER_AGENT</code><p>
129
130 The browser the client is using to send the request. General
131format: <code>software/version library/version</code>.</p><p>
132
133</p></li></ul>
134
135<hr>
136<h2>Examples</h2>
137
138Examples of the setting of environment variables are really much better
139<a href="http://hoohoo.ncsa.uiuc.edu/cgi/examples.html">demonstrated</a> than explained. <p>
140
141</p><hr>
142
143<a href="http://hoohoo.ncsa.uiuc.edu/cgi/interface.html"><img alt="[Back]" src="env_files/back.gif">Return to the
144interface specification</a> <p>
145
146CGI - Common Gateway Interface
147</p><address><a href="http://hoohoo.ncsa.uiuc.edu/cgi/mailtocgi.html">cgi@ncsa.uiuc.edu</a></address>
148
149</body></html>
Note: See TracBrowser for help on using the repository browser.