From 6beeb1b708550be0d4a53b272283e17e5e35fe17 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 17:01:30 +0200 Subject: Adding upstream version 2.4.57. Signed-off-by: Daniel Baumann --- docs/manual/handler.html.zh-cn.utf8 | 157 ++++++++++++++++++++++++++++++++++++ 1 file changed, 157 insertions(+) create mode 100644 docs/manual/handler.html.zh-cn.utf8 (limited to 'docs/manual/handler.html.zh-cn.utf8') diff --git a/docs/manual/handler.html.zh-cn.utf8 b/docs/manual/handler.html.zh-cn.utf8 new file mode 100644 index 0000000..e1256bd --- /dev/null +++ b/docs/manual/handler.html.zh-cn.utf8 @@ -0,0 +1,157 @@ + + + + + +Apache 的处理器 - Apache HTTP 服务器 版本 2.4 + + + + + + + +
<-
+

Apache 的处理器

+
+

可用语言:  en  | + es  | + fr  | + ja  | + ko  | + tr  | + zh-cn 

+
+
此翻译可能过期。要了解最近的更改,请阅读英文版。
+ +

本页描述 Apache 处理器的用法。

+
+ +
top
+
+

什么是处理器

+ + + + +

“处理器”是当文件被调用时,Apache 要执行的动作的内部表示形式。 + 一般来说,每个文件都有基于其文件类型的隐式处理器。通常的文件会被 + 服务器简单处理,但是某些文件类型会被分别“处理”。

+ +

处理器也可以被基于扩展名或位置来明确配置。它们都很有用,这不仅 + 因为它是优雅的方案,而且还允许类型处理器关联到文件 + (参见文件与多个扩展名)。

+ +

处理器可以编译到服务器中,或者包含在模块中,它们还可以被 Action 指令增加。标准发行版中内置的处理器有:

+ +
    +
  • default-handler: 使用 + default_handler() 发送文件,它是用来处理静态内容的处理器(核心)。
  • + +
  • send-as-is: 直接发送,不增加 HTTP 头(mod_asis)。
  • + +
  • cgi-script: 按 CGI 脚本处理(mod_cgi)。
  • + +
  • imap-file: 按 imagemap 规则处理(mod_imagemap)。
  • + +
  • server-info: 取得服务器配置信息(mod_info)。
  • + +
  • server-status: 取得服务器状态报告(mod_status)。
  • + +
  • type-map: 用于内容协商,按类型映射文件处理(mod_negotiation)。
  • +
+
top
+
+

例子

+ + +

使用 CGI 脚本修改静态内容

+ + +

下面的指令将会使具有html扩展名的文件,触发 CGI 脚本footer.pl的执行。

+ +

+ Action add-footer /cgi-bin/footer.pl
+ AddHandler add-footer .html +

+ +

于是 CGI 负责发送请求的文档(PATH_TRANSLATED 环境变量指向它),按照需要作出 and making + whatever modifications or additions are desired.

+ + +

含有 HTTP 头的文件

+ + +

下面的指令会启用 + send-as-is 处理器,用于包含自己的 HTTP 的文件。不管什么扩展名, + 所有位于 /web/htdocs/asis/ 目录的文件会被 + send-as-is 处理器处理。

+ +

+ <Directory /web/htdocs/asis>
+ SetHandler send-as-is
+ </Directory> +

+ + +
top
+
+

对程序员的说明

+ + +

为了实现处理器特性,增加了需要使用的 Apache API。 + 特别的,结构 request_rec 增加了新成员:

+ +

+ char *handler +

+ +

如果你想要模块实现处理器,只需要在在处理请求,调用 invoke_handler + 之前,将 r->handler 指向处理器名称。处理器的实现与以前一样,只是用处理器名称取代了内容类型。 + 虽然不是必要,处理器的命名约定是使用破折号分割的单词,没有斜杠,从而不侵入媒体类型名称空间。

+
+
+

可用语言:  en  | + es  | + fr  | + ja  | + ko  | + tr  | + zh-cn 

+
top

评论

Notice:
This is not a Q&A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Libera.chat, or sent to our mailing lists.
+
+ \ No newline at end of file -- cgit v1.2.3