You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modules-dev@httpd.apache.org by gromeck <gr...@gromeck.de> on 2007/09/17 15:19:18 UTC

My module configuration and AddHandler

Hi everybody,

I am about to port my Apache 1.3 modules to Apache 2.2.
The modules are compile-clean and load into the httpd.

But I am having some trouble:

in Apache 1.3 I defined a handler for per-directory configuration
and I set an AddHandler directive in the config file like this

<Directory /mygifs/>
   AddHandler mymodule .gif
</Directory>

This worked fine: my module only get requests for *.gif files
in the directory /mygifs/.

Now, in Apache 2.2, my module will be called for every request
to the webserver!

I already scanned the documentation. Is this the new behaviour?

I added a configuration directive to my module to enable the
module explicit with something like:

<Directory /mygifs/>
   MyModuleEnable on
</Directory>

Now I get only requests for this directory, but for all types
of files. Do I have to filter out the extension on my own?
Doesn't help AddHandler any longer?

Any ideas?

Schönen Gruss -- gromeck

Re: My module configuration and AddHandler

Posted by Takashi Sato <se...@lans-tv.com>.
On Mon, 17 Sep 2007 15:19:18 +0200
gromeck <gr...@gromeck.de> wrote:

> Now I get only requests for this directory, but for all types
> of files. Do I have to filter out the extension on my own?

You do not have to filter out the extension but the handler name.

Add something like
if (strcmp(r->handler, "mymodule") != 0) return DECLINED;
to the first line of handler function of your module.

-- 
Takashi Sato
serai@lans-tv.com

Re: My module configuration and AddHandler

Posted by Christian Lorenz <Ch...@gromeck.de>.
Hi again,

ok, it seems that I found the solution:

before processing the request, the handler has to checked
if it matches the own handler name. This was already mentioned
in [1]. What wasn't said there is, that also the selection
for which extension the handler should be used work also
that way.

Thanks for your patience.

Schönen Gruss -- gromeck


[1]
http://mail-archives.apache.org/mod_mbox/httpd-modules-dev/200708.mbox/%3cef20daa00708121528q390f89f1x858ce622a36ef41d@mail.gmail.com%3e


gromeck wrote:
> Hi everybody,
> 
> I am about to port my Apache 1.3 modules to Apache 2.2.
> The modules are compile-clean and load into the httpd.
> 
> But I am having some trouble:
> 
> in Apache 1.3 I defined a handler for per-directory configuration
> and I set an AddHandler directive in the config file like this
> 
> <Directory /mygifs/>
>    AddHandler mymodule .gif
> </Directory>
> 
> This worked fine: my module only get requests for *.gif files
> in the directory /mygifs/.
> 
> Now, in Apache 2.2, my module will be called for every request
> to the webserver!
> 
> I already scanned the documentation. Is this the new behaviour?
> 
> I added a configuration directive to my module to enable the
> module explicit with something like:
> 
> <Directory /mygifs/>
>    MyModuleEnable on
> </Directory>
> 
> Now I get only requests for this directory, but for all types
> of files. Do I have to filter out the extension on my own?
> Doesn't help AddHandler any longer?
> 
> Any ideas?
> 
> Schönen Gruss -- gromeck
> 


-- 
Christian Lorenz
Suedliche Ringstr. 31
64560 Riedstadt
Telefon +49 6158 916136
Telefax +49 6158 916137