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 -> Building & Member Downloads View previous topic :: View next topic
Reply to topic   Topic: Apache Module Handler(s)
Author
cygnusceo



Joined: 18 Apr 2008
Posts: 1

PostPosted: Sat 19 Apr '08 1:45    Post subject: Apache Module Handler(s) Reply with quote

I have finally written an apache module and it works fine with the exception of one really odd thing.

My module's handlers seem to get called 3 times for each Request. Why does it do this and How the heck can I stop it.

Thanks in Advance

Jeff
Back to top
tdonovan
Moderator


Joined: 17 Dec 2005
Posts: 611
Location: Milford, MA, USA

PostPosted: Sun 20 Apr '08 19:29    Post subject: Reply with quote

It is not real clear what language, what platform, or which version of Apache you mean
... but guessing that you wrote your handler in "C" for Apache 2.2.8 on Windows:
    1. Did you register your handler function like this?
    Code:
    ap_hook_handler(your_handler_function, NULL, NULL, APR_HOOK_MIDDLE);

    2. Did you put an AddHandler or SetHandler directive in httpd.conf to indicate which files your handler applies to?

    3. Did you test at the beginning of your handler if it was selected by Apache? Something like this:
    Code:
    static int your_handler_function(request_rec *r)
    {   
        if (strcmp(r->handler, "your_handler_name"))
            return DECLINED;

    ... do whatever your handler does ...
        return OK;
    }
Your handler will get called for every request (that's normal), but it should only be called once for each request or subrequest, and it should return DECLINED unless it is the selected handler.

-tom-
Back to top


Reply to topic   Topic: Apache Module Handler(s) View previous topic :: View next topic
Post new topic   Forum Index -> Building & Member Downloads