+ -
当前位置:首页 → 问答吧 → 我想知道,各位希望Web Server传给Perl程序什么命令参数或环境变量。

我想知道,各位希望Web Server传给Perl程序什么命令参数或环境变量。

时间:2010-08-06

来源:互联网

做个调察,谢谢。

作者: folklore   发布时间: 2010-08-06

本帖最后由 DQP 于 2010-08-06 21:18 编辑

就是HTTP那些信息.
想大概看一下的话可以这样.
print Dumper %ENV;

这是从wikipedia上抄下来的List不知道全不全


QUOTE:
Server specific variables
SERVER_SOFTWARE — name/version of HTTP server.
SERVER_NAME — host name of the server, may be dot-decimal IP address.
GATEWAY_INTERFACE — CGI/version.

Request specific variables
SERVER_PROTOCOL — HTTP/version.
SERVER_PORT — TCP port (decimal).
REQUEST_METHOD — name of HTTP method (see above).
PATH_INFO — path suffix, if appended to URL after program name and a slash.
PATH_TRANSLATED — corresponding full path as supposed by server, if PATH_INFO is present.
SCRIPT_NAME — relative path to the program, like /cgi-bin/script.cgi.
QUERY_STRING — the part of URL after ? character. Must be composed of name=value pairs separated with ampersands (such as var1=val1&var2=val2…) and used when form data are transferred via GET method.
REMOTE_HOST — host name of the client, unset if server did not perform such lookup.
REMOTE_ADDR — IP address of the client (dot-decimal).
AUTH_TYPE — identification type, if applicable.
REMOTE_USER used for certain AUTH_TYPEs.
REMOTE_IDENT — see ident, only if server performed such lookup.
CONTENT_TYPE — MIME type of input data if PUT or POST method are used, as provided via HTTP header.
CONTENT_LENGTH — similarly, size of input data (decimal, in octets) if provided via HTTP header.
Variables passed by user agent (HTTP_ACCEPT, HTTP_ACCEPT_LANGUAGE, HTTP_USER_AGENT, HTTP_COOKIE and possibly others) contain values of corresponding HTTP headers and therefore have the same sense.



http://en.wikipedia.org/wiki/Common_Gateway_Interface

作者: DQP   发布时间: 2010-08-06

十分感谢,事实上我做了一个WebServer,我想知道加入哪些变量或参数用户会更加方便



QUOTE:
HTTP_ACCEPT = image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, */*
HTTP_ACCEPT_ENCODING = gzip, deflate
HTTP_ACCEPT_LANGUAGE = ja
HTTP_CONNECTION = Keep-Alive
CONTENT_LENGTH = 398
CONTENT_TYPE = multipart/form-data; boundary=---------------------------7da2ee3270124
HTTP_REFERER = http://localhost/
HTTP_USER_AGENT = Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; CIBA)
GATEWAY_INTERFACE = CGI/1.1
SERVER_PROTOCOL = HTTP/1.1
DOCUMENT_ROOT = D:/httpd/WebRoot/
QUERY_STRING = "arg=value"
SCRIPT_NAME = d:\unicode\db\cgi\debug\execgi.exe
REMOTE_ADDR = 127.0.0.1
REQUEST_METHOD = POST
SERVER_ADMIN = [email protected]
SERVER_NAME = 0.0.0.0
SERVER_PORT = 80
SERVER_S0FTWARE = lws 0.01
REQUEST_URI = /test.gmm


这是某一次的输出,此外,我加入了HTTP_RAGE_BYTES以支持断点续传。当然,这个变量没有出现在上面。因为浏览器没有发出HTTP_RANGE头。

作者: folklore   发布时间: 2010-08-06

所以我想知道,还有其它什么变量没有?网页设计者感兴趣的。

作者: folklore   发布时间: 2010-08-06