logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Having two custom modules to parse same petition
Author
DoHITB



Joined: 16 Feb 2017
Posts: 8
Location: Catalonia, Lleida

PostPosted: Fri 16 Apr '21 20:09    Post subject: Having two custom modules to parse same petition Reply with quote

Hello:
I'm quite new to Apache custom modules, and I have a doubt about having two custom modules to parse the same petition.

First of all, I'm working on Apache/2.4.38 (Raspbian).

Now, let me explain a bit better.

Currenlty I have a custom module that parses every ".calc" petition, so ".../anything.calc" will trigger "calc-handler"

On my .htaccess, I wrote "AddHandler calc-handler .calc" to allow it.

Now, I want to allow acces to another handler that triggers on each server petition, so, let's say...

a) Client request "page1.php", so "general-handler" gets the petition, makes it's process, then the php page it's parsed

b) Client request "anything.calc", so "general-handler" gets the petition, make it's process, then "calc-handler" triggers and makes it's process.

I made a very simple handler, really simillar to the one defined on http://people.apache.org/~humbedooh/mods/examples/mod_example_1.c, but changing

- omit "if (!r->handler || strcmp(r->handler, "example-handler")) return (DECLINED);"

- use "SetHandler" instead of "AddHandler"

The result is that "general-handler" triggers, but then I see no response from "calc-handler".

Is there anything I'm doing wrong? Both modules have definitions of AP_MODULE_DECLARE_DATA and register_hooks in simillar way that the apache web example (so maybe there's something to change there?)


Thanks in advance!
Back to top
DoHITB



Joined: 16 Feb 2017
Posts: 8
Location: Catalonia, Lleida

PostPosted: Sat 17 Apr '21 20:57    Post subject: Reply with quote

Hello

As said on this same forum I just followed a similar way done in https://stackoverflow.com/questions/11097096/ensure-execution-order-of-two-apache-filters, and worked fine.

I had to remove the "Sethandler", and it worked.

Thanks.
Back to top


Reply to topic   Topic: Having two custom modules to parse same petition View previous topic :: View next topic
Post new topic   Forum Index -> Apache