summaryrefslogtreecommitdiffstats
path: root/docs/manual/mod/mod_isapi.xml
blob: 3b10c9e861dec1430bbf31636125dc923b585b00 (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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
<?xml version="1.0"?>
<!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
<?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
<!-- $LastChangedRevision$ -->

<!--
 Licensed to the Apache Software Foundation (ASF) under one or more
 contributor license agreements.  See the NOTICE file distributed with
 this work for additional information regarding copyright ownership.
 The ASF licenses this file to You under the Apache License, Version 2.0
 (the "License"); you may not use this file except in compliance with
 the License.  You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
-->

<modulesynopsis metafile="mod_isapi.xml.meta">

<name>mod_isapi</name>
<description>ISAPI Extensions within Apache for Windows</description>
<status>Base</status>
<sourcefile>mod_isapi.c</sourcefile>
<identifier>isapi_module</identifier>
<compatibility>Win32 only</compatibility>

<summary>
    <p>This module implements the Internet Server extension API. It
    allows Internet Server extensions (<em>e.g.</em> ISAPI .dll
    modules) to be served by Apache for Windows, subject to the
    noted restrictions.</p>

    <p>ISAPI extension modules (.dll files) are written by third
    parties. The Apache Group does not author these modules, so we
    provide no support for them. Please contact the ISAPI's author
    directly if you are experiencing problems running their ISAPI
    extension. <strong>Please <em>do not</em> post such problems to
    Apache's lists or bug reporting pages.</strong></p>
</summary>

<section id="usage"><title>Usage</title>

    <p>In the server configuration file, use
    the <directive module="mod_mime">AddHandler</directive> directive to
    associate ISAPI files with the <code>isapi-handler</code> handler, and map
    it to them with their file extensions. To enable any .dll file to be
    processed as an ISAPI extension, edit the httpd.conf file and add the
    following line:</p>
    <highlight language="config">
        AddHandler isapi-handler .dll
    </highlight>

    <note>In older versions of the Apache server,
    <code>isapi-isa</code> was the proper handler name, rather than
    <code>isapi-handler</code>. As of 2.3 development versions of the Apache
    server, <code>isapi-isa</code> is no longer valid. You will need to
    change your configuration to use <code>isapi-handler</code>
    instead.</note>

    <p>There is no capability within the Apache server to leave a
    requested module loaded. However, you may preload and keep a
    specific module loaded by using the following syntax in your
    httpd.conf:</p>
    <highlight language="config">
        ISAPICacheFile c:/WebWork/Scripts/ISAPI/mytest.dll
    </highlight>

    <p>Whether or not you have preloaded an ISAPI extension, all
    ISAPI extensions are governed by the same permissions and
    restrictions as CGI scripts. That is, <directive module="core"
    >Options</directive> <code>ExecCGI</code> must be set for the
    directory that contains the ISAPI .dll file.</p>

    <p>Review the <a href="#notes">Additional Notes</a> and the <a
    href="#journal">Programmer's Journal</a> for additional details
    and clarification of the specific ISAPI support offered by
    <module>mod_isapi</module>.</p>
</section>

<section id="notes"><title>Additional Notes</title>

    <p>Apache's ISAPI implementation conforms to all of the ISAPI
    2.0 specification, except for some "Microsoft-specific"
    extensions dealing with asynchronous I/O. Apache's I/O model
    does not allow asynchronous reading and writing in a manner
    that the ISAPI could access. If an ISA tries to access
    unsupported features, including async I/O, a message is placed
    in the error log to help with debugging. Since these messages
    can become a flood, the directive <code>ISAPILogNotSupported
    Off</code> exists to quiet this noise.</p>

    <p>Some servers, like Microsoft IIS, load the ISAPI extension
    into the server and keep it loaded until memory usage is too
    high, or unless configuration options are specified. Apache
    currently loads and unloads the ISAPI extension each time it is
    requested, unless the <directive module="mod_isapi"
    >ISAPICacheFile</directive> directive is specified.
    This is inefficient, but Apache's memory model makes this the
    most effective method. Many ISAPI modules are subtly
    incompatible with the Apache server, and unloading these
    modules helps to ensure the stability of the server.</p>

    <p>Also, remember that while Apache supports ISAPI Extensions,
    it <strong>does not support ISAPI Filters</strong>. Support for
    filters may be added at a later date, but no support is planned
    at this time.</p>
</section>

<section id="journal"><title>Programmer's Journal</title>

    <p>If you are programming Apache 2.0 <module>mod_isapi</module>
    modules, you must limit your calls to <code>ServerSupportFunction</code>
    to the following directives:</p>

    <dl>
      <dt><code>HSE_REQ_SEND_URL_REDIRECT_RESP</code></dt>
      <dd>Redirect the user to another location.<br />
      This must be a fully qualified URL (<em>e.g.</em>
      <code>http://server/location</code>).</dd>

      <dt><code>HSE_REQ_SEND_URL</code></dt>
      <dd>Redirect the user to another location.<br />
      This cannot be a fully qualified URL, you are not allowed to
      pass the protocol or a server name (<em>e.g.</em> simply
      <code>/location</code>).<br />
      This redirection is handled by the server, not the
      browser.<br />
      <note type="warning"><title>Warning</title>
        <p>In their recent documentation, Microsoft appears to have
        abandoned the distinction between the two
        <code>HSE_REQ_SEND_URL</code> functions. Apache continues to treat
        them as two distinct functions with different requirements
        and behaviors.</p>
      </note></dd>

      <dt><code>HSE_REQ_SEND_RESPONSE_HEADER</code></dt>
      <dd>Apache accepts a response body following the header if it
      follows the blank line (two consecutive newlines) in the
      headers string argument. This body cannot contain NULLs,
      since the headers argument is NULL terminated.</dd>

      <dt><code>HSE_REQ_DONE_WITH_SESSION</code></dt>
      <dd>Apache considers this a no-op, since the session will be
      finished when the ISAPI returns from processing.</dd>

      <dt><code>HSE_REQ_MAP_URL_TO_PATH</code></dt>
      <dd>Apache will translate a virtual name to a physical
      name.</dd>

      <dt><code>HSE_APPEND_LOG_PARAMETER</code></dt>
      <dd>
        This logged message may be captured in any of the following
        logs:

        <ul>
          <li>in the <code>\"%{isapi-parameter}n\"</code> component in a
          <directive module="mod_log_config">CustomLog</directive>
          directive</li>

          <li>in the <code>%q</code> log component with the
          <directive module="mod_isapi">ISAPIAppendLogToQuery</directive>
          <code>On</code> directive</li>

          <li>in the error log with the <directive module="mod_isapi"
          >ISAPIAppendLogToErrors</directive> <code>On</code> directive</li>
        </ul>

        <p>The first option, the <code>%{isapi-parameter}n</code> component,
        is always available and preferred.</p>
      </dd>

      <dt><code>HSE_REQ_IS_KEEP_CONN</code></dt>
      <dd>Will return the negotiated Keep-Alive status.</dd>

      <dt><code>HSE_REQ_SEND_RESPONSE_HEADER_EX</code></dt>
      <dd>Will behave as documented, although the <code>fKeepConn</code>
      flag is ignored.</dd>

      <dt><code>HSE_REQ_IS_CONNECTED</code></dt>
      <dd>Will report false if the request has been aborted.</dd>
    </dl>

    <p>Apache returns <code>FALSE</code> to any unsupported call to
    <code>ServerSupportFunction</code>, and sets the
    <code>GetLastError</code> value to
    <code>ERROR_INVALID_PARAMETER</code>.</p>

    <p><code>ReadClient</code> retrieves the request body exceeding the
    initial buffer (defined by <directive module="mod_isapi"
    >ISAPIReadAheadBuffer</directive>). Based on the
    <directive>ISAPIReadAheadBuffer</directive> setting (number of bytes
    to buffer prior to calling the ISAPI handler) shorter requests are sent
    complete to the extension when it is invoked. If the request is
    longer, the ISAPI extension must use <code>ReadClient</code> to
    retrieve the remaining request body.</p>

    <p><code>WriteClient</code> is supported, but only with the
    <code>HSE_IO_SYNC</code> flag or no option flag (value of
    <code>0</code>). Any other <code>WriteClient</code> request
    will be rejected with a return value of <code>FALSE</code>, and a
    <code>GetLastError</code> value of
    <code>ERROR_INVALID_PARAMETER</code>.</p>

    <p><code>GetServerVariable</code> is supported, although extended server
    variables do not exist (as defined by other servers.) All the
    usual Apache CGI environment variables are available from
    <code>GetServerVariable</code>, as well as the <code>ALL_HTTP</code>
    and <code>ALL_RAW</code> values.</p>

    <p>Since httpd 2.0, <module>mod_isapi</module> supports additional
    features introduced in later versions of the ISAPI specification,
    as well as limited emulation of async I/O and the
    <code>TransmitFile</code> semantics. Apache httpd also supports preloading
    ISAPI .dlls for performance.</p>
</section>

<directivesynopsis>
<name>ISAPICacheFile</name>
<description>ISAPI .dll files to be loaded at startup</description>
<syntax>ISAPICacheFile <var>file-path</var> [<var>file-path</var>]
...</syntax>
<contextlist><context>server config</context><context>virtual host</context>
</contextlist>

<usage>
    <p>Specifies a space-separated list of file names to be loaded
    when the Apache server is launched, and remain loaded until the
    server is shut down. This directive may be repeated for every
    ISAPI .dll file desired. The full path name of each file should
    be specified. If the path name is not absolute, it will be treated
    relative to <directive module="core">ServerRoot</directive>.</p>
</usage>
</directivesynopsis>

<directivesynopsis>
<name>ISAPIReadAheadBuffer</name>
<description>Size of the Read Ahead Buffer sent to ISAPI
extensions</description>
<syntax>ISAPIReadAheadBuffer <var>size</var></syntax>
<default>ISAPIReadAheadBuffer 49152</default>
<contextlist><context>server config</context><context>virtual host</context>
<context>directory</context><context>.htaccess</context></contextlist>
<override>FileInfo</override>

<usage>
    <p>Defines the maximum size of the Read Ahead Buffer sent to
    ISAPI extensions when they are initially invoked. All remaining
    data must be retrieved using the <code>ReadClient</code> callback; some
    ISAPI extensions may not support the <code>ReadClient</code> function.
    Refer questions to the ISAPI extension's author.</p>
</usage>
</directivesynopsis>

<directivesynopsis>
<name>ISAPILogNotSupported</name>
<description>Log unsupported feature requests from ISAPI
extensions</description>
<syntax>ISAPILogNotSupported on|off</syntax>
<default>ISAPILogNotSupported off</default>
<contextlist><context>server config</context><context>virtual host</context>
<context>directory</context><context>.htaccess</context></contextlist>
<override>FileInfo</override>

<usage>
    <p>Logs all requests for unsupported features from ISAPI
    extensions in the server error log. This may help administrators
    to track down problems. Once set to on and all desired ISAPI modules
    are functioning, it should be set back to off.</p>
</usage>
</directivesynopsis>

<directivesynopsis>
<name>ISAPIAppendLogToErrors</name>
<description>Record <code>HSE_APPEND_LOG_PARAMETER</code> requests from
ISAPI extensions to the error log</description>
<syntax>ISAPIAppendLogToErrors on|off</syntax>
<default>ISAPIAppendLogToErrors off</default>
<contextlist><context>server config</context><context>virtual host</context>
<context>directory</context><context>.htaccess</context></contextlist>
<override>FileInfo</override>

<usage>
    <p>Record <code>HSE_APPEND_LOG_PARAMETER</code> requests from ISAPI
    extensions to the server error log.</p>
</usage>
</directivesynopsis>

<directivesynopsis>
<name>ISAPIAppendLogToQuery</name>
<description>Record <code>HSE_APPEND_LOG_PARAMETER</code> requests from
ISAPI extensions to the query field</description>
<syntax>ISAPIAppendLogToQuery on|off</syntax>
<default>ISAPIAppendLogToQuery on</default>
<contextlist><context>server config</context><context>virtual host</context>
<context>directory</context><context>.htaccess</context></contextlist>
<override>FileInfo</override>

<usage>
    <p>Record <code>HSE_APPEND_LOG_PARAMETER</code> requests from ISAPI
    extensions to the query field (appended to the <directive
    module="mod_log_config">CustomLog</directive> <code>%q</code>
    component).</p>
</usage>
</directivesynopsis>

<directivesynopsis>
<name>ISAPIFakeAsync</name>
<description>Fake asynchronous support for ISAPI callbacks</description>
<syntax>ISAPIFakeAsync on|off</syntax>
<default>ISAPIFakeAsync off</default>
<contextlist><context>server config</context><context>virtual host</context>
<context>directory</context><context>.htaccess</context></contextlist>
<override>FileInfo</override>

<usage>
    <p>While set to on, asynchronous support for ISAPI callbacks is
    simulated.</p>
</usage>
</directivesynopsis>

</modulesynopsis>