This page has been robot translated, sorry for typos if any. Original content here.

All about CGI (Common Gateway Interface)

What is CGI?

Start with the terminology. CGI - Commom Gateway Interface is an interface that, at the request of a browser, allows a web server to launch any programs on itself and also display the result of their work to the browser. CGI program (script) - a program (script) that works on the server also communicating with the browser through the above interface. Since there is no strict regulation about the definitions of terms, there are often, to say CGI , because of the program (script), but not the interface itself.

If it is a program, then it should be able to use any executable format that is acceptable for a specific operating system. Programs can be written on anything: C / C ++, Pascal, Java, Visual, also just Basic, delphi, etc.

If it is a script (script), then on the operating system, under which the web server spins, there is a corresponding script interpreter: shell, perl, tcl / tk, command.com, etc.

Generally, in order for the CGI program (script) to be developed, it met the following needs: - allow you to pronounce from the standard input stream (stdin) - acquire the values ​​of environmental variables (environment variables) - enter the standard conclusion stream (stdout)

What is CGI used for?

  • Work with reference systems and databases.
  • Creating dynamic HTML documents and resources (including counters, guest books, etc.)
  • Remote administration of various systems.
  • Just work with various programs, since the HTML interface is quite convenient to use, easy to make, it also looks nice :)

Labor Mechanism CGI Programs

As already mentioned, CGI acquires input from the standard input stream stdin or from environment variables, but outputs the results of its labor to the standard conclusion stream of stdout . For those. who does not know what it is: Standard input stream (stdin) - hence the program (script) by default acquires input information. This is usually a keyboard, but it can be reassigned; also, a program (script) will acquire input data from a file, socket, output stream of another program.

Environment variables are the variables defined for the system and the server on which the CGI will be executed. .

Standard output stream (stdout) - here the program (script) displays the results of its work. This is usually a “monitor”, but it is allowed to reassign it to a file, a socket, an input stream of another program, a printer, etc.

Most of the examples in this manual are written in the shell just to simplify the presentation of the material.

Since the final security trends, the use of a shell for writing CGI scripts is not recommended .

1.1 Calling CGI without parameters

The simplest script to display the current date is: #!/bin/sh echo Content-type: text/html echo echo " Today is " date echo " "

#!/bin/sh echo Content-type: text/html echo echo " Today is " date echo " "

#!/bin/sh echo Content-type: text/html echo echo " Today is " date echo " " In the HTML act, the link to it is described like this <a href = http: //translate.googleusercontent.com/translate_c? depth = 1 & amp; hl = en & amp; prev = hp & amp; rurl = translate.google.com & amp; sl = ru & amp; sp = nmt & amp; tl = en & amp; u = http://www.shram.kiev.ua/cgi-bin/examples/today.cgi&xid=17259,15700021,15700186,15700190,15700248,15700253&usg=ALkJrhi1ZzGglz4EDMCK5FTehIp__8S1PQ>

IMPORTANT REMARK The basic error, which is made by almost everyone who starts writing CGI programs or scripts, is that they forget to insert a pointer to the type of output result - the title of the output document. This is also the third line in the example.

echo Content-type: text / html echo where Content-type: is the type of the output act (text / html, image / gif, image / jpeg, etc.).
The empty line in the conclusion expresses that the heading ended also follows the actual document itself.

1.2 Passing CGI Parameters to a Script or Program

The transfer of parameters is done by a couple of basic methods: GET and POST . Each of them has its advantages and disadvantages.

When using GET, the parameters are added to the requested URL, and you can also call it this way:

http: // some_host / cgi-bin / some_script? options which allows you to act on such a script links in HTML documents. And on the server, the passed parameters are assigned to the variable QUERY_STRING.

Text of the script itself: #!/bin/sh echo Content-type: text/html echo echo " Вы посылали вот это: " echo " " set | grep QUERY_STRING echo "
" echo " Environment
" set echo ""</code> и как он вызывался из этого документа: <a href=http://translate.googleusercontent.com/translate_c?depth=1&amp;hl=ru&amp;prev=hp&amp;rurl=translate.google.com&amp;sl=ru&amp;sp=nmt4&amp;tl=en&amp;u=http://www.shram.kiev.ua/cgi-bin/examples/link.cgi%3Fsome_parameters&amp;xid=17259,15700021,15700186,15700190,15700248,15700253&amp;usg=ALkJrhj376_y2lsNFu51zDyLv4bEuY_2NA> Образец труда (ткните тут) </a>

#!/bin/sh echo Content-type: text/html echo echo " Вы посылали вот это: " echo " " set | grep QUERY_STRING echo "
" echo " Environment
" set echo ""</code> и как он вызывался из этого документа: <a href=http://translate.googleusercontent.com/translate_c?depth=1&amp;hl=ru&amp;prev=hp&amp;rurl=translate.google.com&amp;sl=ru&amp;sp=nmt4&amp;tl=en&amp;u=http://www.shram.kiev.ua/cgi-bin/examples/link.cgi%3Fsome_parameters&amp;xid=17259,15700021,15700186,15700190,15700248,15700253&amp;usg=ALkJrhj376_y2lsNFu51zDyLv4bEuY_2NA> Образец труда (ткните тут) </a>

#!/bin/sh echo Content-type: text/html echo echo " Вы посылали вот это: " echo " " set | grep QUERY_STRING echo "
" echo " Environment
" set echo ""</code> и как он вызывался из этого документа: <a href=http://translate.googleusercontent.com/translate_c?depth=1&amp;hl=ru&amp;prev=hp&amp;rurl=translate.google.com&amp;sl=ru&amp;sp=nmt4&amp;tl=en&amp;u=http://www.shram.kiev.ua/cgi-bin/examples/link.cgi%3Fsome_parameters&amp;xid=17259,15700021,15700186,15700190,15700248,15700253&amp;usg=ALkJrhj376_y2lsNFu51zDyLv4bEuY_2NA> Образец труда (ткните тут) </a>

#!/bin/sh echo Content-type: text/html echo echo " Вы посылали вот это: " echo " " set | grep QUERY_STRING echo "
" echo " Environment
" set echo ""</code> и как он вызывался из этого документа: <a href=http://translate.googleusercontent.com/translate_c?depth=1&amp;hl=ru&amp;prev=hp&amp;rurl=translate.google.com&amp;sl=ru&amp;sp=nmt4&amp;tl=en&amp;u=http://www.shram.kiev.ua/cgi-bin/examples/link.cgi%3Fsome_parameters&amp;xid=17259,15700021,15700186,15700190,15700248,15700253&amp;usg=ALkJrhj376_y2lsNFu51zDyLv4bEuY_2NA> Образец труда (ткните тут) </a>
<code>#!/bin/sh echo Content-type: text/html echo echo " Вы посылали вот это: " echo " <b>" set | grep QUERY_STRING echo "</b> <br> " echo " <b>Environment</b> <br> " set echo ""&lt;/code&gt; и как он вызывался из этого документа: &lt;a href=http://translate.googleusercontent.com/translate_c?depth=1&amp;amp;hl=ru&amp;amp;prev=hp&amp;amp;rurl=translate.google.com&amp;amp;sl=ru&amp;amp;sp=nmt4&amp;amp;tl=en&amp;amp;u=http://www.shram.kiev.ua/cgi-bin/examples/link.cgi%3Fsome_parameters&amp;amp;xid=17259,15700021,15700186,15700190,15700248,15700253&amp;amp;usg=ALkJrhj376_y2lsNFu51zDyLv4bEuY_2NA&gt; Образец труда (ткните тут) &lt;/a&gt;</code> #!/bin/sh echo Content-type: text/html echo echo " Вы посылали вот это: " echo " " set | grep QUERY_STRING echo "
" echo " Environment
" set echo ""</code> и как он вызывался из этого документа: <a href=http://translate.googleusercontent.com/translate_c?depth=1&amp;hl=ru&amp;prev=hp&amp;rurl=translate.google.com&amp;sl=ru&amp;sp=nmt4&amp;tl=en&amp;u=http://www.shram.kiev.ua/cgi-bin/examples/link.cgi%3Fsome_parameters&amp;xid=17259,15700021,15700186,15700190,15700248,15700253&amp;usg=ALkJrhj376_y2lsNFu51zDyLv4bEuY_2NA> Образец труда (ткните тут) </a>
<code>#!/bin/sh echo Content-type: text/html echo echo " Вы посылали вот это: " echo " <b>" set | grep QUERY_STRING echo "</b> <br> " echo " <b>Environment</b> <br> " set echo ""&lt;/code&gt; и как он вызывался из этого документа: &lt;a href=http://translate.googleusercontent.com/translate_c?depth=1&amp;amp;hl=ru&amp;amp;prev=hp&amp;amp;rurl=translate.google.com&amp;amp;sl=ru&amp;amp;sp=nmt4&amp;amp;tl=en&amp;amp;u=http://www.shram.kiev.ua/cgi-bin/examples/link.cgi%3Fsome_parameters&amp;amp;xid=17259,15700021,15700186,15700190,15700248,15700253&amp;amp;usg=ALkJrhj376_y2lsNFu51zDyLv4bEuY_2NA&gt; Образец труда (ткните тут) &lt;/a&gt;</code>

It’s unacceptable to use the GET method to pass parameters containing confidential information, since in this case, all this information is transmitted openly.

The POST method allows you to ensure confidentiality when passing parameters to the script. But it passes the parameters to the standard input stream and for this it is necessary to use forms. The server does not send the EOF script at the end of the transfer. Instead, you will have to use the CONTENT_LENGTH variable environment in order to determine what data capacity you need to calculate from stdin.

Line counter

Recently, the number of people who want to attach a visitor counter to their page is growing at a frantic pace. On the Internet, there are plenty of places where people can take whatever counters they like for any operating system and screw them onto their pages.

This head of the manual will be more likely to be useful to those who are interested in the mechanism of labor of the counters, since all the attached examples have special tricks on settings, administration, etc. do not possess. For more sophisticated, ready-to-use counters, look at Altavista, Yahoo, and other search engines. Or ask in the relevant news conferences (relcom.www.users, relcom.www.support; in fidosh ekhah ru.internet. *).

2.1 Types of meters

According to the labor mechanism, the counters can be divided into a pair of types:
  1. CGI scripts working as Server Side Include
  2. CGI scripts that do not use Server Side Include
Server Side Include (SSI) is an HTML comment type that indicates to the Web server that it is necessary to substitute dynamically generated data in the call room. The basic format of an SSI call in the body of an HTML document is as follows:

<!--#command tag="value"...-->

where #command is any of the numerous commands understood by the Web server. In this case, the most interesting is the #exec command, which allows you to run programs and also substitute the results of their work. The HTML documents analyzed by the Web server are called server-parsed documents.

2.2 Visitor counter working as SSI

A work algorithm:

  1. The server acquires a request for an HTML document from the browser.
  2. The server is viewing the act for an SSI call.
  3. If such calls are detected, then the result is substituted on their premises. In the case of the #exec command , the result of the work of the program specified in "value" .
  4. The generated HTML act was launched back to the browser.

Required server settings (on Apache sample server):

  1. Register in the srm.conf file (if it hasn’t been written there yet): AddType text / html .shtml AddHandler server-parsed .shtml These directives express to the server that files with the .shtml extension are server-parsed documents.
  2. In the access.conf file on the directory where server-parsed documents will be located, in Options add the Includes option.
  3. Assign the .shtml extension to files containing SSI calls (see § 1)
We will demonstrate how the counter works on the sample counter script found on the Internet at http://www.webtools.org/. It is written in Perl, which is so popular today.

In from here we will calculate: <! - # exec cgi = "/ cgi-bin / counter" ->
(click Reload until you get bored)

This is a text counter, i.e. the script gives just the text, which is shown. Similarly allowed to enclose pictures. For this, it is necessary that instead of text numbers the tags img src = "picture_s_sotvetsvuyu_tsifroy." The curious reader will easily guess that the number of tags img src ... is equal to the number of digits in the value returned by the counter.

The call to this counter in the body of the act is performed by the command: <!--#exec cgi="/cgi-bin/counter"-->

2.3 Counter does not use SSI

More ingenious from the point of view of the user, but more complicated in programming is the meter that does not use SSI. The mechanism of such a counter is the following:

  • The body of the HTML act indicates: &lt;img src = / cgi-bin / examples / counter.cgi&gt; those. The requested picture is in no way static, but dynamically generated by a CGI script.
  • the server, receiving a request for a picture, runs the script specified in the src tag img .
  • the script increases the counter value per item, generates a picture with the counter value also gives it to the browser.

Since this type of meter is the most popular on the Internet, we consider the algorithm of its work in more detail.

With crypts ( counter.cgi ), which is called in the body of an HTML document by the img src = "... counter.cgi" tag, the following source text is also written in the shell (line numbers are added only to simplify the explanation): 1: #!/bin/sh 2: now=`date -u` 3: echo "Content-type: image/gif;" 4: echo "Expires: $now" 5: echo 6: counter|showdigits 1: #!/bin/sh 2: now=`date -u` 3: echo "Content-type: image/gif;" 4: echo "Expires: $now" 5: echo 6: counter|showdigits

This script is valid (line description):
1 - The title of the script itself. He points to the command interpreter which one will execute it.

2 - Define the now variable, which contains the time the script was run (the time to create the image). The key ' -u ' says that the creation date / time is displayed in GMT . Why this should be described below.

3 - We are trying to form the server objection header. Specify the type of the returned data: image / gif

4 - Since this is a counter, it is necessary to ensure that the card with its readings is not cached in any way (and which one it is later than this counter :) . To do this, we indicate that the image received by the browser should immediately be sprinkled. Here we also use the now variable defined in line number 2. The use of Expires in this form complies with the standard for HTTP protocol version 1.1. But when using Expires equal to the date of creation of the act, funny glitches can begin, if the hours on the customer are several minutes behind the server’s hours. The dilemma begins - according to the standard, it is supposed to be like this, but it’s not what we need. What to do? In the previous version of the protocol (HTTP 1.0), Expires was allowed to be set to 0, but RFC2068 states that clients also using HTTP 1.1 caches must support the ancient variation of using Expires (Expires: 0). So shta, dear Russians, decide for yourself.

5 - End of objection header - return an empty string.

6 - Using two programs (counter also showdigits) generate the image itself.

The counter programs also showdigits are written in C using the library for working with GIF files - libgd. Without it, the program will not compile. The latest version of the library is always available at http://www.boutell.com/gd/ .

These programs are valid:

  • counter - reads from the counter.rc file the quantity, which is the previous value of the counter, adds one to it and also scribbles back. If the route to the files - pictures with numbers is also not specified, the mask of these files is also taken, then the default one, which is defined in the program body, is taken. After that, it computed the value of the counter, also the route to the pictures, is output to stdout, which forms the command line for showdigits.
  • showdigits - this program, in fact, also forms a picture with the current reading of the counter. For this purpose, a set of ready-made pictures with numbers (gif format, all pictures of the same size) are also received on stdin from counter data. Along the route, the mask and the number of images taken are also taken from them one hypha is collected. Then he goes straight to ... stdout ! And then the server redirects this stream to the browser as well (the browser) illustrates it as a picture, since the header of the objection indicates that it is a hypha.
In essence here is the essence: - The server sends a stream of data to the browser. - The browser doesn’t really care where, as well as the server, the data stream passed to it (whether it is static or dynamically generated; a regular file or the result of the script), the essence is that the browser knows how to interpret it correctly. For this is the title, which in this sample was generated by the counter.cgi script, but exactly in 3-5 lines (see above). Moreover, in the case of static files, the server itself generates this header, based on its own settings, but in the case of cgi, this should be done by the script itself.

Server side includes

It's clear that static HTML documents are good, but dynamically created documents are even better. :) So, in this head we will talk about the dynamic creation of documents using Server Side Includes. At once, we note that the ability to use SSI is the ability of each specific server. Some servers do not support SSI in any way, but those that have such an opportunity may also have different formats for command sets. So read the manual for your web server. All examples in this chapter are for Apache.

3.1 What is SSI

As already mentioned in the previous chapter, Server Side Include (SSI) is a Web server directive that allows the server to substitute any data for a call. In an HTML act, an SSI call looks like a format comment:

<!--#command tag="value"...-->

where #command is any of the SSI directives understood by the Web server, but " value " is its parameters.

The substitute data can be static and also dynamically generated. Static data is already ready, recorded as files, fragments of text or HTML. It is convenient to use such data in the case when duplicate fragments are placed in different HTML documents. Dynamically generated data is the results of the labor of any CGI scripts or commands of the operating system that the specific Web server is running on. The use of this type of data provides the Web developer with huge opportunities. But, as the moronic Russian-bourgeois advertisement says, - “Do not forget about sugar-free Orbits!”. I mean, REMEMBER MEASURES FOR COMPLIANCE WITH SAFETY ACCESS TO INFORMATION! Incorrect use of SSI can lead to the possibility of unauthorized access to information and, accordingly, to various grave consequences. .

3.2 Basic SSI Directives

config controls various aspects of parsing a document. Attributes: errmsg error message returned to the client, if any failure occurred during the parsing of the document. sizefmt sets the file size conclusion format (bytes, kilobytes, megabytes). timefmt sets the date / time format. echo prints the value of one of the following environment variables. Attributes: var name of the printed exec variable executes the specified command or CGI script. Attributes: cgi specifies (% -coded) URL-relative route to the CGI script. If the route does not begin with (/), it is assumed that the route is specified relative to the current document.

The CGI script is passed so that the values ​​of the PATH_INFO and QUERY_STRING variables of the original client request are transferred.

The cmd server executes the specified string using the operating system command interpreter. fsize prints the size of the specified file, taking into account sizefmt . Attributes: file specifies the route to the file relative to the current directory containing the file being analyzed. virtual indicates (% -coded) URL-relative route to the file. If the route does not begin with (/), it is considered that the route is specified relative to the current document. flastmod prints the date / time of the final modification of the specified file, taking into account timefmt . Attributes are blah like the fsize command. include inserts the text of another act or file into the document being analyzed. Very useful for repeating fragments in different documents. Attributes: file specifies the path to the file only relative to the current directory containing the file being analyzed. virtual indicates (% -coded) URL-relative route to the file. If the route does not begin with (/), it is considered that the route is specified relative to the current document. In Apache, files included in this way may exist as nested files. printenv prints a list of all existing variables and their values. No attributes. Example:
<!--#printenv --> set sets the value of a variable. Attributes: var indicates the name of the variable to be set. value specifies the value of the variable to be set. Example:
<!--#set var="variable_1" value="some_value_of_variable_1" -->

3.3 SSI Environment Variables

DOCUMENT_NAME - file name Description in the body of the document: <!--#echo var="DOCUMENT_NAME" --> Result of use: <! - # echo var = "DOCUMENT_NAME" ->

DOCUMENT_URI - virtual route to the file Description in the body of the document: <!--#echo var="DOCUMENT_URI" --> Result of use: <! - # echo var = "DOCUMENT_URI" ->

QUERY_STRING_UNESCAPED - decoding a query string, with all shell metacharacters preceded by "\" Description in the body of the document: <!--#echo var="QUERY_STRING_UNESCAPED" --> Result of use: (none)

DATE_LOCAL - the current date is also time (local) Description in the body of the document: <!--#echo var="DATE_LOCAL" --> Result of use: <! - # echo var = "DATE_LOCAL" ->

DATE_GMT - current date is also time (GMT) Description in the body of the document: <!--#echo var="DATE_GMT" --> Result of use: <! - # echo var = "DATE_GMT" ->

LAST_MODIFIED - the date is also the time of the final file change Description in the body of the document: <!--#echo var="LAST_MODIFIED" --> Result of use: <! - # echo var = "LAST_MODIFIED" ->

3.4 Server Configuration

In order for the server to know in which room in the act to insert the data, he is forced to analyze this act. The documents analyzed by the server are called server-parsed documents.

First of all, it is necessary to make the server aware of what documents it should analyze. To do this, the configuration file (for old versions of Apache and NCSA web servers is the srm.conf file, but for new versions of Apache, for example 1.3.4 - httpd.conf ), you need to add the following parameters: Apache server:

AddType text / html .shtml &lt;br&gt; AddHandler server-parsed .shtml

NCSA Server:

AddType text / x-server-parsed-html .shtml The specified parameters express that all files with the extension .shtml are server-parsed , also before “giving” this act to the customer, the server must analyze them.

Why specify a separate extension for server-parsed documents? - asks an inquisitive reader. We answer. Of course, no one person prevents you from adding a line to the configuration file.

AddType text / x-server-parsed-html .html However, this will cause the server to examine all documents with the extension .html, even if they do not have an SSI call, the system load will increase, but server performance will decrease.

We should not forget that it is unsuccessful to include the SSI call in the CGI program, since their conclusion by the server is not analyzed.

For more information on configuring your server for SSI, read the documentation on your server.

Applications

Appendix 1. Server Environment Variables

Below is a list of the main server environment variables with a brief description of the purpose. In this case, the Apache 1.2.5 server with the PHP / FI-2.0.1 module. For other web servers (MS IIS, Netscape, NCSA httpd, etc.) the variables may differ.

REMOTE_HOST is the hostname of the host connected to the server. In the case of work through a proxy, the name of the proxy.
Example: REMOTE_HOST = lom.pvrr.ru

REMOTE_ADDR - IP address of the host connected to the server. In the case of work through a proxy, the IP address of the proxy.
Example: REMOTE_ADDR = 194.87.186.11

REMOTE_PORT is the port number of the client.
Example: REMOTE_PORT = 3381

HTTP_USER_AGENT - name / version number / etc. customer (browser). Using this variable sometimes frightens individual Internet users. :) But at the very lesson is a very useful thing. For example, for autodetection of Russian encodings.
Example: HTTP_USER_AGENT = Mozilla / 4.07 [en] (X11; I; FreeBSD 2.2.6-RELEASE i386)

HTTP_ACCEPT - data types, in addition to text / html, perceived by the client (browser)
Example: HTTP_ACCEPT = image / gif, image / x-xbitmap, image / jpeg, image / pjpeg, image / png, * / *

HTTP_ACCEPT_CHARSET - which charsets are understood by the customer (browser).
Example: HTTP_ACCEPT_CHARSET = iso-8859-1, *, utf-8

HTTP_ACCEPT_LANGUAGE - which languages ​​the customer perceives (browser).
Example: HTTP_ACCEPT_LANGUAGE = nl, nl-BE, ru

* * *

SERVER_NAME is the server name corresponding to the IN A record in DNS, or the value of the ServerName variable (or similar) in the server config.
Example: SERVER_NAME = arche.pvrr.ru

HTTP_HOST is the name of the server or virtual host that the client is accessing. The HTTP_HOST value may exist equal to the SERVER_NAME value.
Example: HTTP_HOST = www.pvrr.ru

SERVER_SOFTWARE - what software is used as a server.
Example: SERVER_SOFTWARE = ​​Apache / 1.2.5 PHP / FI-2.0.1

DOCUMENT_ROOT - route to the "root" of the web server from the "root" of the file system of the computer on which it runs.
Example: DOCUMENT_ROOT = / usr / local / www / html

HTTP_CONNECTION - connection type.
Example: HTTP_CONNECTION = keep-alive

SERVER_PROTOCOL is a protocol used to exchange data with a specific client.
Example: SERVER_PROTOCOL = HTTP / 1.0

REQUEST_URI - the name of the requested resource / document, including the path from the root of the web server. When referring to the server root or directory, this variable is assigned the name of the directory or "/" in the case of the server root.
Example: REQUEST_URI = / cgi-bin / tralala / script.cgi

DOCUMENT_URI - the name of the requested resource / document, including the path from the root of the web server. Normally initialized when calling SSI. В отличие от REQUEST_URI эта переменная, в случае обращения к каталогу либо корню сервера получает значение содержащее также имя файла, являющегося Directory Index'ом этого каталога.
Пример: DOCUMENT_URI=/tralala/index.shtml

HTTP_REFERER - наполненный URL документа, по ссылке с которого вы попали на этот сервер. Данную переменную разрешено использовать при написании счетчиков.
Пример: HTTP_REFERER=http://lom.pvrr.ru/java/cgi/cgi_1.html

GATEWAY_INTERFACE - название/версия интерфейса, чрез какой сервер работает со скриптом.
Пример: GATEWAY_INTERFACE=CGI/1.1

SCRIPT_FILENAME - имя скрипта, содержащее наполненный маршрут от "корня" файловой системы.
Пример:SCRIPT_FILENAME=/usr/local/www/cgi-bin/tralala/script.cgi

SCRIPT_NAME - имя скрипта, содержащее маршрут от "корня" веб-сервера.
Пример: SCRIPT_NAME=/cgi-bin/tralala/script.cgi

REQUEST_METHOD - метод используемый заказчиком для передачи данных серверу. Бывают GET, HEAD, POST, PUT.
Пример: REQUEST_METHOD=GET

QUERY_STRING - этой переменной значение присваивается при передаче данных серверу методом GET
Пример: QUERY_STRING=button=on

CONTENT_LENGTH - этой переменной присваивается значение, равное количеству байт, переданных браузером серверу при использовании метода POST.
Пример: CONTENT_LENGTH=9

REMOTE_USER - имя пользователя. Передается только если аутентифицируется доступ к CGI скрипту.

PATH_INFO - дополнительная информация о маршруту, которую передал клиент. То кушать скрипт может приобретать некоторые параметры, содержащие информауцию о некотором "маршруте" к некоторым данным (например к файлу конфигурации, необходимому для отделки запроса отименно этого клиента). Этот маршрут "виртуальный" - т.е от "корня веб-сервера". Остальные данные разрешено передавать как обычно - методом GET или POST.
Пример: PATH_INFO=/some/path

PATH_TRANSLATED - то бла бла , что также PATH_INFO, только маршрут физический - "от корня файловой системы"

REMOTE_IDENT - Если HTTP сервер поддерживает идентификацию согласно RFC 931, то этой переменной присваивается имя пользователя получаемое от сервера.

SERVER_ADMIN - e-mail правителя веб-сервера.
Пример: SERVER_ADMIN=webmaster@www.pvrr.ru

SERVER_PORT - порт, какой "слушает" веб-сервер.
Пример: SERVER_PORT=80

* * *

HTTP_X_FORWARDED_FOR - в случае труда чрез прокси - IP адрес клиента, работаеющего чрез прокси.
Пример: HTTP_X_FORWARDED_FOR=194.87.186.11

HTTP_VIA - имя, номер порта, разновидность ПО прокси-сервера.
Пример: HTTP_VIA=1.0 proxy1.pvrr.ru:8080 (Squid/2.1.PATCH1)

HTTP_CACHE_CONTROL - что-то связанное с возрастом акта в кэше прокси сервера :) Лгать никак не буду - никак не знаю :)
Пример: HTTP_CACHE_CONTROL=max-age=259200