| 描述: | 使用sed语法过滤输入(请求)和输出(响应)内容 |
|---|---|
| 状态: | 实验性 |
| 模块标识符: | sed_module |
| 源文件: | mod_sed.c sed0.c sed1.c regexp.c regexp.h sed.h |
| 兼容性: | 在Apache 2.3及更高版本中可用 |
mod_sed是一个进程内内容过滤器。该mod_sed过滤器实现了sedSolaris 10 sed
程序实现的编辑命令,如手册页中所述。但是,与不同sed,mod_sed它不会从标准输入中获取数据。而是,筛选器作用于在客户端和服务器之间发送的实体数据。mod_sed可用作输入或输出滤波器。mod_sed是内容过滤器,这意味着它不能用于修改客户端或服务器的HTTP标头。
的mod_sed输出过滤器接受数据块,执行sed对数据的脚本,并产生被传送到链中的下一个过滤器的输出。
所述mod_sed输入滤波器读取从下一个过滤器中的数据链,执行该sed脚本,并将产生的数据返回到所述过滤器链中的呼叫者滤波器。
如果在内容中看到换行符,则输入和输出过滤器都只处理数据。在数据末尾,其余数据被视为最后一行。
# In the following example, the sed filter will change the string
# "monday" to "MON" and the string "sunday" to SUN in html documents
# before sending to the client.
<Directory "/var/www/docs/sed">
AddOutputFilter Sed html
OutputSed "s/monday/MON/g"
OutputSed "s/sunday/SUN/g"
</Directory>
# In the following example, the sed filter will change the string
# "monday" to "MON" and the string "sunday" to SUN in the POST data
# sent to PHP.
<Directory "/var/www/docs/sed">
AddInputFilter Sed php
InputSed "s/monday/MON/g"
InputSed "s/sunday/SUN/g"
</Directory>
该sed命令的完整详细信息可以在
sed手册页中找到。
bhHgGx