![什么是 Lynx CGI 脚本?](https://linux22.com/image/222079/%E4%BB%80%E4%B9%88%E6%98%AF%20Lynx%20CGI%20%E8%84%9A%E6%9C%AC%EF%BC%9F.png)
在 中lynx.cfg
,它包含:
.h1 CGI scripts
# These settings control Lynx's ability to execute various types of scripts.
.h2 LOCAL_EXECUTION_LINKS_ALWAYS_ON
.h2 LOCAL_EXECUTION_LINKS_ON_BUT_NOT_REMOTE
# Local execution links and scripts are by default completely disabled,
# unless a change is made to the userdefs.h file to enable them or
# the configure script is used with the corresponding options
# (-enable-exec-links and -enable-exec-scripts).
# See the Lynx source code distribution and the userdefs.h
# file for more detail on enabling execution links and scripts.
#
# If you have enabled execution links or scripts the following
# two variables control Lynx's action when an execution link
# or script is encountered.
#
# If LOCAL_EXECUTION_LINKS_ALWAYS_ON is set to TRUE any execution
# link or script will be executed no matter where it came from.
# This is EXTREMELY dangerous. Since Lynx can access files from
# anywhere in the world, you may encounter links or scripts that
# will cause damage or compromise the security of your system.
#
# If LOCAL_EXECUTION_LINKS_ON_BUT_NOT_REMOTE is set to TRUE only
# links or scripts that reside on the local machine and are
# referenced with a URL beginning with "file://localhost/" or meet
# TRUSTED_EXEC or ALWAYS_TRUSTED_EXEC rules (see below) will be
# executed. This is much less dangerous than enabling all execution
# links, but can still be dangerous.
#
#LOCAL_EXECUTION_LINKS_ALWAYS_ON:FALSE
#LOCAL_EXECUTION_LINKS_ON_BUT_NOT_REMOTE:FALSE
.h2 TRUSTED_EXEC
# If LOCAL_EXECUTION_LINK_ON_BUT_NOT_REMOTE is TRUE, and no TRUSTED_EXEC
# rule is defined, it defaults to "file://localhost/" and any lynxexec
# or lynxprog command will be permitted if it was referenced from within
# a document whose URL begins with that string. If you wish to restrict the
# referencing URLs further, you can extend the string to include a trusted
# path. You also can specify a trusted directory for http URLs, which will
# then be treated as if they were local rather than remote. For example:
#
# TRUSTED_EXEC:file://localhost/trusted/
# TRUSTED_EXEC:http://www.wfbr.edu/trusted/
#
# If you also wish to restrict the commands which can be executed, create
# a series of rules with the path (Unix) or command name (VMS) following
# the string, separated by a tab. For example:
#
# Unix:
# ====
# TRUSTED_EXEC:file://localhost/<tab>/bin/cp
# TRUSTED_EXEC:file://localhost/<tab>/bin/rm
# VMS:
# ===
# TRUSTED_EXEC:file://localhost/<tab>copy
# TRUSTED_EXEC:file://localhost/<tab>delete
#
# Once you specify a TRUSTED_EXEC referencing string, the default is
# replaced, and all the referencing strings you desire must be specified
# as a series. Similarly, if you associate a command with the referencing
# string, you must specify all of the allowable commands as a series of
# TRUSTED_EXEC rules for that string. If you specify ALWAYS_TRUSTED_EXEC
# rules below, you need not repeat them as TRUSTED_EXEC rules.
#
# If EXEC_LINKS and JUMPFILE have been defined, any lynxexec or lynxprog
# URLs in that file will be permitted, regardless of other settings. If
# you also set LOCAL_EXECUTION_LINKS_ON_BUT_NOT_REMOTE:TRUE and a single
# TRUSTED_EXEC rule that will always fail (e.g., "none"), then *ONLY* the
# lynxexec or lynxprog URLs in JUMPFILE (and any ALWAYS_TRUSTED_EXEC rules,
# see below) will be allowed. Note, however, that if Lynx was compiled with
# CAN_ANONYMOUS_JUMP set to FALSE (default is TRUE), or -restrictions=jump
# is included with the -anonymous switch at run time, then users of an
# anonymous account will not be able to access the jumps file or enter
# 'j'ump shortcuts, and this selective execution feature will be overridden
# as well (i.e., they will only be able to access lynxexec or lynxprog
# URLs which meet any ALWAYS_TRUSTED_EXEC rules).
#
#TRUSTED_EXEC:none
.h2 ALWAYS_TRUSTED_EXEC
# If EXEC_LINKS was defined, any lynxexec or lynxprog URL can be made
# always enabled by an ALWAYS_TRUSTED_EXEC rule for it. This is useful for
# anonymous accounts in which you have disabled execution links generally,
# and may also have disabled jumps file links, but still want to allow
# execution of particular utility scripts or programs. The format is
# like that for TRUSTED_EXEC. For example:
#
# Unix:
# ====
# ALWAYS_TRUSTED_EXEC:file://localhost/<tab>/usr/local/kinetic/bin/usertime
# ALWAYS_TRUSTED_EXEC:http://www.more.net/<tab>/usr/local/kinetic/bin/who.sh
# VMS:
# ===
# ALWAYS_TRUSTED_EXEC:file://localhost/<tab>usertime
# ALWAYS_TRUSTED_EXEC:http://www.more.net/<tab>show users
#
# The default ALWAYS_TRUSTED_EXEC rule is "none".
#
#ALWAYS_TRUSTED_EXEC:none
.h2 TRUSTED_LYNXCGI
# Unix:
# =====
# TRUSTED_LYNXCGI rules define the permitted sources and/or paths for
# lynxcgi links (if LYNXCGI_LINKS is defined in userdefs.h). The format
# is the same as for TRUSTED_EXEC rules (see above). Example rules:
#
# TRUSTED_LYNXCGI:file://localhost/
# TRUSTED_LYNXCGI:<tab>/usr/local/etc/httpd/cgi-bin/
# TRUSTED_LYNXCGI:file://localhost/<tab>/usr/local/www/cgi-bin/
#
# VMS:
# ====
# Do not define this.
#
# The default TRUSTED_LYNXCGI rule is "none".
#
TRUSTED_LYNXCGI:none
.h2 LYNXCGI_ENVIRONMENT
# Unix:
# =====
# LYNXCGI_ENVIRONMENT adds the current value of the specified
# environment variable to the list of environment variables passed on to the
# lynxcgi script. Useful variables are HOME, USER, etc... If proxies
# are in use, and the script invokes another copy of lynx (or a program like
# wget) in a subsidiary role, it can be useful to add http_proxy and other
# *_proxy variables.
#
# VMS:
# ====
# Do not define this.
#
#LYNXCGI_ENVIRONMENT:
.h2 LYNXCGI_DOCUMENT_ROOT
# Unix:
# =====
# LYNXCGI_DOCUMENT_ROOT is the value of DOCUMENT_ROOT that will be passed
# to lynxcgi scripts. If set and the URL has PATH_INFO data, then
# PATH_TRANSLATED will also be generated. Examples:
# LYNXCGI_DOCUMENT_ROOT:/usr/local/etc/httpd/htdocs
# LYNXCGI_DOCUMENT_ROOT:/data/htdocs/
#
# VMS:
# ====
# Do not define this.
#
#LYNXCGI_DOCUMENT_ROOT:
Lynx 在这种情况下指的是哪种类型的脚本?它似乎不是 JavaScript(并且多个来源表明 Lynx 不支持它)。
CGI脚本不是主要在服务器端执行吗?
为什么像 Lynx 这样的网络浏览器会参与其中?
答案1
从在线文档:
这山猫网址:
lynxcgi URL 仅在 Unix 上实现,可以用作 FORM 的 ACTION,并且如果在您的山猫图像的格式为:
lynxcgi://localhost/path_to_CGI_script
其中
//localhost
是可选的并且始终是隐含的;应指定完整路径,因为“~”无法识别;如果脚本在目录中山猫从开始,简单的文件名就足够了。脚本的输出应该是text/html,并由以下方式渲染和显示山猫。可以在userdefs.h
和lynx.cfg
、qv 中对 lynxcgi 的使用和可接受的路径施加限制。这是 Lynxism,只能在本地文档中使用山猫,或在没有 http 服务器的情况下对 CGI 脚本进行有限的本地测试。
另请参阅以下部分中的注释表格:
Lynx 识别 TABLE 元素及其所有关联元素,如中所述RFC 1942并将处理开始标记中的任何 ID 属性,以作为 NAME-ed 锚点进行处理,但不会创建实际的桌子。相反,它将 TR 开始标记视为可折叠 BR(换行符),并在每个 TH 和 TD 开始标记的内容之前插入可折叠空格。 [...]
从版本 2.8.3 开始,Lynx 以表格形式呈现一些表格。该表格表示为简单的表(TRST)并不尝试实现对任何表模型的完全支持。 [...]
对于更复杂表格的表格显示,Lynx 用户可以使用外部脚本或程序。普通的 Lynx 发行版目前不提供此类脚本,但可以在本地编写或从多个来源下载它们。建议使用 Lynx 的工具之一来调用外部程序(请参阅
DOWNLOADER
、PRINTER
、EXTERNAL
、TRUSTED_LYNXCGI
山猫cfg 和lynxcgi:
在支持的网址有关设置此功能的各种方法的信息)。
一些谷歌搜索导致一个这样的脚本。我不认为对语言有任何限制 - 只要它是可执行的并生成 HTML 输出,一切都应该没问题。