summaryrefslogtreecommitdiff
path: root/usr.sbin/httpd/htdocs/manual/mod/mod_actions.html
blob: e813007011f23f7947cdd31e2f47fdbd201d7ed5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta name="generator" content="HTML Tidy, see www.w3.org" />

    <title>Module mod_actions</title>
  </head>
  <!-- Background white, links blue (unvisited), navy (visited), red (active) -->

  <body bgcolor="#FFFFFF" text="#000000" link="#0000FF"
  vlink="#000080" alink="#FF0000">
        <div align="CENTER">
      <img src="../images/sub.gif" alt="[APACHE DOCUMENTATION]" /> 

      <h3>Apache HTTP Server Version 1.3</h3>
    </div>


    <h1 align="CENTER">Module mod_actions</h1>

    <p>This module provides for executing CGI scripts based on
    media type or request method.</p>

    <p><a href="module-dict.html#Status"
    rel="Help"><strong>Status:</strong></a> Base<br />
     <a href="module-dict.html#SourceFile"
    rel="Help"><strong>Source File:</strong></a>
    mod_actions.c<br />
     <a href="module-dict.html#ModuleIdentifier"
    rel="Help"><strong>Module Identifier:</strong></a>
    action_module<br />
     <a href="module-dict.html#Compatibility"
    rel="Help"><strong>Compatibility:</strong></a> Available in
    Apache 1.1 and later.</p>

    <h2>Summary</h2>

    <p>This module has two directives. The Action directive lets
    you run CGI scripts whenever a file of a certain type is
    requested. The Script directive lets you run CGI scripts
    whenever a particular method is used in a request. This makes
    it much easier to execute scripts that process files.</p>

    <h2>Directives</h2>

    <ul>
      <li><a href="#action">Action</a></li>

      <li><a href="#script">Script</a></li>
    </ul>
    <hr />

    <h2><a id="action" name="action">Action directive</a></h2>

    <p><a href="directive-dict.html#Syntax"
    rel="Help"><strong>Syntax:</strong></a> Action <em>action-type
    cgi-script</em><br />
     <a href="directive-dict.html#Context"
    rel="Help"><strong>Context:</strong></a> server config, virtual
    host, directory, .htaccess<br />
     <a href="directive-dict.html#Override"
    rel="Help"><strong>Override:</strong></a> FileInfo<br />
     <a href="directive-dict.html#Status"
    rel="Help"><strong>Status:</strong></a> Base<br />
     <a href="directive-dict.html#Module"
    rel="Help"><strong>Module:</strong></a> mod_actions<br />
     <a href="directive-dict.html#Compatibility"
    rel="Help"><strong>Compatibility:</strong></a> Action is only
    available in Apache 1.1 and later</p>

    <p>This directive adds an action, which will activate
    <em>cgi-script</em> when <em>action-type</em> is triggered by the
    request.  The <i>cgi-script</i> is the URL-path to a resource that
    has been configured as a CGI script using <code>ScriptAlias</code>
    or <code>AddHandler</code>. The <em>action-type</em> can be either
    a <a href="../handler.html">handler</a> or a MIME content type. It
    sends the URL and file path of the requested document using the
    standard CGI PATH_INFO and PATH_TRANSLATED environment
    variables.</p>

    <p>Examples:</p>
    <pre>
    # Requests for files of a particular type:
    Action image/gif /cgi-bin/images.cgi

    # Files of a particular file extension
    AddHandler my-file-type .xyz
    Action my-file-type /cgi-bin/program.cgi
    </pre>

    <p>In the first example, requests for files with a MIME content
    type of <code>image/gif</code> will instead be handled by the
    specified cgi script <code>/cgi-bin/images.cgi</code>.</p>

    <p>In the second example, requests for files with a file extension of
    <code>.xyz</code> are handled instead by the specified cgi script 
    <code>/cgi-bin/program.cgi</code>.</p>

    <p><strong>See also</strong>: <a 
        href="mod_mime.html#addhandler">AddHandler</a></p>

    <hr />

    <h2><a id="script" name="script">Script directive</a></h2>

    <p><a href="directive-dict.html#Syntax"
    rel="Help"><strong>Syntax:</strong></a> Script <em>method
    cgi-script</em><br />
     <a href="directive-dict.html#Context"
    rel="Help"><strong>Context:</strong></a> server config, virtual
    host, directory<br />
     <a href="directive-dict.html#Status"
    rel="Help"><strong>Status:</strong></a> Base<br />
     <a href="directive-dict.html#Module"
    rel="Help"><strong>Module:</strong></a> mod_actions<br />
     <a href="directive-dict.html#Compatibility"
    rel="Help"><strong>Compatibility:</strong></a> Script is only
    available in Apache 1.1 and later; arbitrary method use is only
    available with 1.3.10 and later</p>

    <p>This directive adds an action, which will activate
    <i>cgi-script</i> when a file is requested using the method of
    <i>method</i>. The <i>cgi-script</i> is the URL-path to a resource
    that has been configured as a CGI script using
    <code>ScriptAlias</code> or <code>AddHandler</code>.  The URL and
    file path of the requested document is sent using the standard CGI
    PATH_INFO and PATH_TRANSLATED environment variables.</p>

    <blockquote>
      Prior to Apache 1.3.10, <i>method</i> can only be one of
      <code>GET</code>, <code>POST</code>, <code>PUT</code>, or
      <code>DELETE</code>. As of 1.3.10, any arbitrary method name
      may be used. <b>Method names are case-sensitive</b>, so
      <code>Script&nbsp;PUT</code> and <code>Script&nbsp;put</code>
      have two entirely different effects.
    </blockquote>

    <p>Note that the Script 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 Script 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>

    <p>Examples:</p>
<pre>
    # For &lt;ISINDEX&gt;-style searching
    Script GET /cgi-bin/search
    # A CGI PUT handler
    Script PUT /~bob/put.cgi
</pre>
        <hr />

    <h3 align="CENTER">Apache HTTP Server Version 1.3</h3>
    <a href="./"><img src="../images/index.gif" alt="Index" /></a>
    <a href="../"><img src="../images/home.gif" alt="Home" /></a>

  </body>
</html>