mod_actions.xml revision 1f79dc7df35b8c2b48ac99b54a5e8c236cd63847
135c1278adef96d36fd421c536b1acc54a341cfbsf<?xml version="1.0"?>
135c1278adef96d36fd421c536b1acc54a341cfbsf<!DOCTYPE modulesynopsis SYSTEM "/style/modulesynopsis.dtd">
135c1278adef96d36fd421c536b1acc54a341cfbsf<?xml-stylesheet type="text/xsl" href="/style/manual.en.xsl"?>
135c1278adef96d36fd421c536b1acc54a341cfbsf<!-- $LastChangedRevision$ -->
135c1278adef96d36fd421c536b1acc54a341cfbsf
135c1278adef96d36fd421c536b1acc54a341cfbsf<!--
135c1278adef96d36fd421c536b1acc54a341cfbsf Licensed to the Apache Software Foundation (ASF) under one or more
135c1278adef96d36fd421c536b1acc54a341cfbsf contributor license agreements. See the NOTICE file distributed with
135c1278adef96d36fd421c536b1acc54a341cfbsf this work for additional information regarding copyright ownership.
135c1278adef96d36fd421c536b1acc54a341cfbsf The ASF licenses this file to You under the Apache License, Version 2.0
135c1278adef96d36fd421c536b1acc54a341cfbsf (the "License"); you may not use this file except in compliance with
135c1278adef96d36fd421c536b1acc54a341cfbsf the License. You may obtain a copy of the License at
135c1278adef96d36fd421c536b1acc54a341cfbsf
135c1278adef96d36fd421c536b1acc54a341cfbsf http://www.apache.org/licenses/LICENSE-2.0
135c1278adef96d36fd421c536b1acc54a341cfbsf
135c1278adef96d36fd421c536b1acc54a341cfbsf Unless required by applicable law or agreed to in writing, software
135c1278adef96d36fd421c536b1acc54a341cfbsf distributed under the License is distributed on an "AS IS" BASIS,
135c1278adef96d36fd421c536b1acc54a341cfbsf WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
135c1278adef96d36fd421c536b1acc54a341cfbsf See the License for the specific language governing permissions and
135c1278adef96d36fd421c536b1acc54a341cfbsf limitations under the License.
135c1278adef96d36fd421c536b1acc54a341cfbsf-->
135c1278adef96d36fd421c536b1acc54a341cfbsf
135c1278adef96d36fd421c536b1acc54a341cfbsf<modulesynopsis metafile="mod_actions.xml.meta">
135c1278adef96d36fd421c536b1acc54a341cfbsf
135c1278adef96d36fd421c536b1acc54a341cfbsf<name>mod_actions</name>
135c1278adef96d36fd421c536b1acc54a341cfbsf
135c1278adef96d36fd421c536b1acc54a341cfbsf<description>This module provides for executing CGI scripts based on
135c1278adef96d36fd421c536b1acc54a341cfbsfmedia type or request method.</description>
135c1278adef96d36fd421c536b1acc54a341cfbsf
135c1278adef96d36fd421c536b1acc54a341cfbsf<status>Base</status>
135c1278adef96d36fd421c536b1acc54a341cfbsf<sourcefile>mod_actions.c</sourcefile>
135c1278adef96d36fd421c536b1acc54a341cfbsf<identifier>actions_module</identifier>
135c1278adef96d36fd421c536b1acc54a341cfbsf
135c1278adef96d36fd421c536b1acc54a341cfbsf<summary>
135c1278adef96d36fd421c536b1acc54a341cfbsf <p>This module has two directives. The <directive
135c1278adef96d36fd421c536b1acc54a341cfbsf module="mod_actions">Action</directive> directive lets you run CGI
135c1278adef96d36fd421c536b1acc54a341cfbsf scripts whenever a file of a certain <glossary
135c1278adef96d36fd421c536b1acc54a341cfbsf ref="mime-type">MIME content type</glossary> is requested. The
135c1278adef96d36fd421c536b1acc54a341cfbsf <directive module="mod_actions">Script</directive> directive lets
135c1278adef96d36fd421c536b1acc54a341cfbsf you run CGI scripts whenever a particular method is used in a
135c1278adef96d36fd421c536b1acc54a341cfbsf request. This makes it much easier to execute scripts that process
135c1278adef96d36fd421c536b1acc54a341cfbsf files.</p> </summary>
135c1278adef96d36fd421c536b1acc54a341cfbsf
135c1278adef96d36fd421c536b1acc54a341cfbsf<seealso><module>mod_cgi</module></seealso>
135c1278adef96d36fd421c536b1acc54a341cfbsf<seealso><a href="/howto/cgi.html">Dynamic Content with CGI</a></seealso>
135c1278adef96d36fd421c536b1acc54a341cfbsf<seealso><a href="/handler.html">Apache httpd's Handler Use</a></seealso>
135c1278adef96d36fd421c536b1acc54a341cfbsf
135c1278adef96d36fd421c536b1acc54a341cfbsf<directivesynopsis>
135c1278adef96d36fd421c536b1acc54a341cfbsf<name>Action</name>
135c1278adef96d36fd421c536b1acc54a341cfbsf<description>Activates a CGI script for a particular handler or
135c1278adef96d36fd421c536b1acc54a341cfbsfcontent-type</description>
135c1278adef96d36fd421c536b1acc54a341cfbsf<syntax>Action <var>action-type</var> <var>cgi-script</var> [virtual]</syntax>
135c1278adef96d36fd421c536b1acc54a341cfbsf<contextlist>
135c1278adef96d36fd421c536b1acc54a341cfbsf<context>server config</context><context>virtual host</context>
135c1278adef96d36fd421c536b1acc54a341cfbsf<context>directory</context><context>.htaccess</context>
135c1278adef96d36fd421c536b1acc54a341cfbsf</contextlist>
135c1278adef96d36fd421c536b1acc54a341cfbsf<override>FileInfo</override>
135c1278adef96d36fd421c536b1acc54a341cfbsf<compatibility>The <code>virtual</code> modifier and handler passing were
135c1278adef96d36fd421c536b1acc54a341cfbsfintroduced in Apache 2.1</compatibility>
135c1278adef96d36fd421c536b1acc54a341cfbsf
135c1278adef96d36fd421c536b1acc54a341cfbsf<usage>
135c1278adef96d36fd421c536b1acc54a341cfbsf <p>This directive adds an action, which will activate
135c1278adef96d36fd421c536b1acc54a341cfbsf <var>cgi-script</var> when <var>action-type</var> is triggered by
135c1278adef96d36fd421c536b1acc54a341cfbsf the request. The <var>cgi-script</var> is the URL-path to a
135c1278adef96d36fd421c536b1acc54a341cfbsf resource that has been designated as a CGI script using <directive
135c1278adef96d36fd421c536b1acc54a341cfbsf module="mod_alias">ScriptAlias</directive> or <directive
135c1278adef96d36fd421c536b1acc54a341cfbsf module="mod_mime">AddHandler</directive>. The
135c1278adef96d36fd421c536b1acc54a341cfbsf <var>action-type</var> can be either a <a
135c1278adef96d36fd421c536b1acc54a341cfbsf href="/handler.html">handler</a> or a <glossary
135c1278adef96d36fd421c536b1acc54a341cfbsf ref="mime-type">MIME content type</glossary>. It sends the URL and
135c1278adef96d36fd421c536b1acc54a341cfbsf file path of the requested document using the standard CGI
135c1278adef96d36fd421c536b1acc54a341cfbsf <code>PATH_INFO</code> and <code>PATH_TRANSLATED</code>
135c1278adef96d36fd421c536b1acc54a341cfbsf environment variables. The handler used for the particular request
135c1278adef96d36fd421c536b1acc54a341cfbsf is passed using the <code>REDIRECT_HANDLER</code> variable.</p>
135c1278adef96d36fd421c536b1acc54a341cfbsf
135c1278adef96d36fd421c536b1acc54a341cfbsf <example><title>Example: MIME type</title>
135c1278adef96d36fd421c536b1acc54a341cfbsf # Requests for files of a particular MIME content type:<br />
135c1278adef96d36fd421c536b1acc54a341cfbsf Action image/gif /cgi-bin/images.cgi<br />
135c1278adef96d36fd421c536b1acc54a341cfbsf <br />
135c1278adef96d36fd421c536b1acc54a341cfbsf </example>
135c1278adef96d36fd421c536b1acc54a341cfbsf
135c1278adef96d36fd421c536b1acc54a341cfbsf <p>In this example, requests for files with a MIME content
135c1278adef96d36fd421c536b1acc54a341cfbsf type of <code>image/gif</code> will be handled by the
135c1278adef96d36fd421c536b1acc54a341cfbsf specified cgi script <code>/cgi-bin/images.cgi</code>.</p>
135c1278adef96d36fd421c536b1acc54a341cfbsf
<example><title>Example: File extension</title>
# Files of a particular file extension<br />
AddHandler my-file-type .xyz<br />
Action my-file-type /cgi-bin/program.cgi<br />
</example>
<p>In this example, requests for files with a file extension of
<code>.xyz</code> are handled by the specified cgi script
<code>/cgi-bin/program.cgi</code>.</p>
<p>The optional <code>virtual</code> modifier turns off the check
whether the requested file really exists. This is useful, for example,
if you want to use the <directive>Action</directive> directive in
virtual locations.</p>
<example><title>Example</title>
&lt;Location /news&gt;<br />
<indent>
SetHandler news-handler<br />
Action news-handler /cgi-bin/news.cgi virtual<br />
</indent>
&lt;/Location&gt;
</example>
</usage>
<seealso><directive module="mod_mime">AddHandler</directive></seealso>
</directivesynopsis>
<directivesynopsis>
<name>Script</name>
<description>Activates a CGI script for a particular request
method.</description>
<syntax>Script <var>method</var> <var>cgi-script</var></syntax>
<contextlist>
<context>server config</context><context>virtual host</context>
<context>directory</context></contextlist>
<usage>
<p>This directive adds an action, which will activate
<var>cgi-script</var> when a file is requested using the method of
<var>method</var>. The <var>cgi-script</var> is the URL-path to a
resource that has been designated as a CGI script using <directive
module="mod_alias">ScriptAlias</directive> or <directive
module="mod_mime">AddHandler</directive>. The URL and
file path of the requested document is sent using the standard CGI
<code>PATH_INFO</code> and <code>PATH_TRANSLATED</code> environment
variables.</p>
<note>
Any arbitrary method name may be used. <strong>Method names are
case-sensitive</strong>, so <code>Script PUT</code> and
<code>Script put</code> have two entirely different
effects.
</note>
<p>Note that the <directive>Script</directive> command defines default
actions only. If a CGI script is called, or some other resource that is
capable of handling the requested method internally, it will do
so. Also note that <directive>Script</directive> with a method of
<code>GET</code> will only be called if there are query arguments present
(<em>e.g.</em>, foo.html?hi). Otherwise, the request will
proceed normally.</p>
<example><title>Examples</title>
# All GET requests go here<br />
Script GET /cgi-bin/search<br />
<br />
# A CGI PUT handler<br />
Script PUT /~bob/put.cgi<br />
</example>
</usage>
</directivesynopsis>
</modulesynopsis>