On 2012-08-22 09:31, Adi Selitzky wrote:
Hi!
I am writing my own module that handles all incoming requests. In some cases, I 
want this request to be handled by mod_python which I installed. In these 
cases, my module should change the requested file extension to .py, which is 
configured to be handled by mod_python.

AddHandler mod_python .py

I have tow questions:
1. How can I set the modules order, so my module will handle the request first, 
change its url, and then mod_python will handle it?

const char *succ[] = {"mod_python.c", NULL};
ap_hook_handler(&your_handler, NULL, succ, APR_HOOK_FIRST);

2. Which field in the request_rec I should change so it will take effect? I 
tried to change the URL key in subprocess_env table, but the request was not 
handled by mod_python.

"AddHandler mod_python .py" simply sets r->handler to "mod_python" if r->filename contains .py. So I guess that the python processing is triggered by r->handler being "mod_python".

So you can try setting r->handler = "mod_python" and then return DECLINED from your handler and forget about appending .py.


Sorin

Reply via email to