]> granicus.if.org Git - apache/blob - modules/examples/README
mod_ssl: Ensure that the SSL close notify alert is flushed to the client.
[apache] / modules / examples / README
1 README for Apache 2.0 Example Module
2 [April, 1997, updated May 2000]
3
4 The files in the src/modules/examples directory under the Apache
5 distribution directory tree are provided as an example to those that
6 wish to write modules that use the Apache API.
7
8 The main file is mod_example_hooks.c, which illustrates all the different
9 callback mechanisms and call syntaces.  By no means does an add-on
10 module need to include routines for all of the callbacks - quite the
11 contrary!
12
13 The example module is an actual working module.  If you link it into
14 your server, enable the "example-hooks-handler" handler for a location,
15 and then browse to that location, you will see a display of some of the
16 tracing the example module did as the various callbacks were made.
17
18 To include the example module in your server add --enable-example-hooks
19 to the other ./configure arguments executed from the httpd source tree.
20 After that run 'make'.
21
22 To add another module of your own:
23
24     A. cp modules/examples/mod_example_hooks.c modules/examples/mod_myexample.c
25     B. Modify the file
26     C. Add an entry to modules/examples/config.m4, e.g.
27          APACHE_MODULE(myexample, my new module, , , no)
28        The last argument specifies if the module is built by-default
29     D. Build the server with --enable-myexample
30
31 For windows, the process is slightly different;
32
33     A. copy modules\examples\mod_example_hooks.c modules\examples\mod_myexample.c
34     B. copy modules\examples\mod_example_hooks.dsp modules\examples\mod_myexample.dsp
35     C. replace the occurances of 'example_hooks' with your module name.
36     D. add the new .dsp to your Apache.dsw workspace, with dependencies
37        on the libapr, libaprutil and libhttpd projects.  With the newer
38        Developer Studio 2002 through 2005, when you add the new .dsp
39        file it will be converted to a .vcproj file.
40
41 To activate the example module, include a block similar to the
42 following in your httpd.conf file:
43
44     <Location /example-info>
45         SetHandler example-hooks-handler
46     </Location>
47
48 As an alternative, you can put the following into a .htaccess file and
49 then request the file "test.example" from that location:
50
51     AddHandler example-hooks-handler .example
52
53 After reloading/restarting your server, you should be able to browse
54 to this location and see the brief display mentioned earlier.