-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathenv_info.cgi
More file actions
65 lines (54 loc) · 2.1 KB
/
env_info.cgi
File metadata and controls
65 lines (54 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/perl -wT
use strict;
my %env_info = (
SERVER_SOFTWARE => "the server software",
SERVER_NAME => "the server hostname or IP address",
GATEWAY_INTERFACE => "the CGI specification revision",
SERVER_PROTOCOL => "the server protocol name",
SERVER_PORT => "the port number for the server",
REQUEST_METHOD => "the HTTP request method",
PATH_INFO => "the extra path info",
PATH_TRANSLATED => "the extra path info translated",
DOCUMENT_ROOT => "the server document root directory",
SCRIPT_NAME => "the script name",
QUERY_STRING => "the query string",
REMOTE_HOST => "the hostname of the client",
REMOTE_ADDR => "the IP address of the client",
AUTH_TYPE => "the authentication method",
REMOTE_USER => "the authenticated username",
REMOTE_IDENT => "the remote user is (RFC 931): ",
CONTENT_TYPE => "the media type of the data",
CONTENT_LENGTH => "the length of the request body",
HTTP_ACCEPT => "the media types the client accepts",
HTTP_USER_AGENT => "the browser the client is using",
HTTP_REFERER => "the URL of the referring page",
HTTP_COOKIE => "the cookie(s) the client sent"
);
print "Content-type: text/html\n\n";
print <<END_OF_HEADING;
<HTML>
<HEAD>
<TITLE>A List of Environment Variables</TITLE>
</HEAD>
<BODY>
<H1>CGI Environment Variables</H1>
<TABLE BORDER=1>
<TR>
<TH>Variable Name</TH>
<TH>Description</TH>
<TH>Value</TH>
</TR>
END_OF_HEADING
my $name;
# Add additional variables defined by web server or browser
foreach $name ( keys %ENV ) {
$env_info{$name} = "an extra variable provided by this server"
unless exists $env_info{$name};
}
foreach $name ( sort keys %env_info ) {
my $info = $env_info{$name};
my $value = $ENV{$name} || "<I>Not Defined</I>";
print "<TR><TD><B>$name</B></TD><TD>$info</TD><TD>$value</TD></TR>\n";
}
print "</TABLE>\n";
print "</BODY></HTML>\n";