web-hints env
Colored stars mark differences BESTWWWD as compared to the Apache server:
[*] = good (works better at www.best.com)
[#] = bad (misfeature or bug)
[%] = neither (just different from Apache)

ENV variables available to SHTML documents

The variables can be included in a server-parsed (*.shtml) document using
<!--#echo var="VARIABLE_NAME"-->.
(The Apache-1.2.6 server understands <!--#printenv --> but BESTWWWD does not.)

Variables defined by server's envronment and configuration file

DOCUMENT_ROOT=/usr/home/inwap/www/htdocs  [%]
    (not set by BESTWWD because SCRIPT_NAME and DOCUMENT_URI are
    absolute and are different for each WWWDirect! virtual host)
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/usr/local/sbin:/usr/local/bin:/usr/local/ibin
    (used by CGI programs find other UNIX executables)
SERVER_ADMIN=webmaster@inwap.com  [%]
    (if defined in the server's configuration file)
SERVER_NAME=inwap.com
    (set to virtual server for Best's WWWDirect! facility)
SERVER_PORT=80
    (the default port for HTTP is 80)
SERVER_PROTOCOL=HTTP/1.0
    (usually set to "HTTP/1.0")
SERVER_SOFTWARE=Apache/1.3.42 (Unix) mod_auth_tkt/2.1.0 FrontPage/5.0.2.2635 mod_ssl/2.8.31 OpenSSL/0.9.8r
    (such as BESTWWWD/1.0 or Apache/1.2.6)
TZ=(none)   [*]
    ("Etc/UTC" or "GMT" on BESTWWD, not set on Apache)

Variables set from the browser's HTTP request

Not all browsers send this information.
HTTP_ACCEPT=(none) 
    (usually includes image/gif and image/jpeg)
HTTP_ACCEPT_ENCODING=(none) 
    ("gzip, deflate")
HTTP_ACCEPT_LANGUAGE=(none) 
    ("en-us" or whatever is the user's preferences are)
HTTP_CONNECTION=(none)
    (defined as "Keep-Alive" in newer versions of Netscape)
HTTP_HOST=www.inwap.com
    (host name from URL, browser used this for the DNS lookup for IP address)
HTTP_PRAGMA=(none)
    (set to "no-cache" if browser's RELOAD button was clicked)
HTTP_REFERER=(none)
    (this is page that had the link to here, not set if URL typed in manually)
HTTP_USER_AGENT=WebVac (nee Pita) (webmaster@pita.stanford.edu)
    (name of browser; Microsoft Internet Explorer is "Mozilla compatible")
AUTH_TYPE=(none)
    (set only on password protected pages)
REMOTE_USER=(none)
    (set only on password protected pages after user name is entered)
REMOTE_PORT=53001
    (Apache: TCP/IP port number at browser's end, from 2049 to 65535)

CGI variables (for Common Gateway Interface programs)

Some of these variables may be set for SHTML documents, but they are defined for use by CGI programs.
CONTENT_LENGTH=(none)
    (set for <FORM ACTION="POST">)
GATEWAY_INTERFACE=CGI/1.1
    (usually set to "CGI/1.1")
PATH_INFO=(none)
    (set if extra characters follow the CGI script name on original URL)
PATH_TRANSLATED=(none)
    (result of translating PATH_INFO from virtual name to file name)
REQUEST_METHOD=GET
    (usually GET or POST)
REQUEST_URI=/web-hints/env.shtml  [#]
    (Apache: the part of the URL after "http://$SERVERNAME:$SERVERPORT")
QUERY_STRING=
    (set for ISMAP, ISINDEX, METHOD=GET, or a URL with a question mark)

Common variables (for documents and CGI programs)

REMOTE_ADDR=171.67.65.214
    (IP address where browser is running)
REMOTE_HOST=WB14.Stanford.EDU.

    (host name, if reverse DNS lookup succeeds)
SCRIPT_NAME=/web-hints/env.shtml  [*]
    (Apache uses virtual name of script)
    (BESTWWWD sets it to the absolute path name of .shtml or .cgi)
SCRIPT_FILENAME=/usr/home/inwap/www/htdocs/web-hints/env.shtml  [*]
    (BESTWWWD does not use this variable)
DATE_GMT=Monday, 27-May-2013 15:13:37 GMT
DATE_LOCAL=Monday, 27-May-2013 15:13:37 GMT

Document variables (not set up for simple CGI references)

DOCUMENT_URI=/web-hints/env.shtml [#]
  (Apache: virtual name, same as REQUEST_URI except for nested includes)
  (BESTWWWD: absolute pathname to file)  
DOCUMENT_NAME=env.shtml

  (name of file without the directory components)
DOCUMENT_PATH_INFO= [#]
  (whatever came after the name of a .shtml file)
  (BESTWWWD returns "500 Server Error - accessing url.2" instead)
USER_NAME=inwap    [#]
  (Apache: owner of the document, name or "user#123")
LAST_MODIFIED=Tuesday, 05-Feb-2002 05:06:53 GMT    [#]
  (Apache defines LAST_MODIFIED for *.shtml and includes the time zone.)
  (BESTWWWD defines LAST_MODIFIED to GMT for "#exec".)
  (BESTWWWD does not allow "#echo var=LAST_MODIFIED" but it should.)
<!--#flastmod file="env.shtml"--> = Tuesday, 05-Feb-2002 05:06:53 GMT

CGI from inside HTML

Note that because the CGI script is invoked by <!--#EXEC CGI="scriptname"--> instead of by <A HREF="scriptname"> then it inherits from the parent document DATE_GMT, DATE_LOCAL, DOCUMENT_URI, DOCUMENT_NAME, LAST_MODIFIED. It also inherits the parent's QUERY_STRING.

(At least that's the way it's supposed to work. LAST_MODIFIED is funny. It is not set for a simple CGI, it is not set [#] for "#echo var=" in *.shtml documents, but it is available to any CGI invoked from an *.shtml document. Go figure.)

Apache does not allow "../" in the name of the CGI file, but BESTWWD does. [*]
CGI names starting with "./" or "../" are not translated to canonical form. [#]

Here is a list of ENV variables available to a CGI script called via the server-side include mechanism:

<hr><!--#exec cgi="./env.cgi"--><hr>

[an error occurred while processing this directive]

Using '#exec cmd=' instead

Apache sets SCRIPT_NAME to DOCUMENT_URI; the shtml that is invoking 'exec cmd'. BESTWWD sets SCRIPT_NAME is set to the argument of "cmd=". [*]

<pre> <!--#exec cmd="env | sort"--> </pre>

DATE_GMT=Monday, 27-May-2013 15:13:37 GMT
DATE_LOCAL=Monday, 27-May-2013 15:13:37 GMT
DOCUMENT_NAME=env.shtml
DOCUMENT_PATH_INFO=
DOCUMENT_ROOT=/usr/home/inwap/www/htdocs
DOCUMENT_URI=/web-hints/env.shtml
GATEWAY_INTERFACE=CGI/1.1
HTTP_FROM=webmaster@pita.stanford.edu
HTTP_HOST=www.inwap.com
HTTP_USER_AGENT=WebVac (nee Pita) (webmaster@pita.stanford.edu)
LAST_MODIFIED=Tuesday, 05-Feb-2002 05:06:53 GMT
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/usr/local/sbin:/usr/local/bin:/usr/local/ibin
PHPRC=/usr/home/inwap/www
QUERY_STRING=
REMOTE_ADDR=171.67.65.214
REMOTE_PORT=53001
REQUEST_METHOD=GET
REQUEST_URI=/web-hints/env.shtml
SCRIPT_FILENAME=/usr/home/inwap/www/htdocs/web-hints/env.shtml
SCRIPT_NAME=/web-hints/env.shtml
SCRIPT_URI=http://inwap.com/web-hints/env.shtml
SCRIPT_URL=/web-hints/env.shtml
SERVER_ADDR=130.94.177.175
SERVER_ADMIN=webmaster@inwap.com
SERVER_NAME=inwap.com
SERVER_PORT=80
SERVER_PROTOCOL=HTTP/1.0
SERVER_SIGNATURE=
Apache/1.3.42 Server at inwap.com Port 80
SERVER_SOFTWARE=Apache/1.3.42 (Unix) mod_auth_tkt/2.1.0 FrontPage/5.0.2.2635 mod_ssl/2.8.31 OpenSSL/0.9.8r USER_NAME=inwap

See also

hoohoo.ncsa.uiuc.edu/cgi/env.html
has NCSA's reference material on CGI variables.
www.best.com/FAQ/bestwwwd.html
is the preliminary documentation for BESTWWWD, dated 20-Jul-95.


up
Maintained by Joe Smith at js-cgi@inwap.com