如何为每个请求默认调用apache模块?

时间:2016-07-21 20:30:03

标签: c apache apache2 apache2.2 apr

我开发了一个apache模块,我在其中从请求中收集一些数据。如何在Apache中默认为每个请求调用我的模块?我在C中写了我的模块。

我的模块声明代码

module AP_MODULE_DECLARE_DATA helloworld_module = {
STANDARD20_MODULE_STUFF,
NULL,
NULL,
NULL,
NULL,
NULL,
helloworld_hooks
};

这是我的模块钩子代码

static void helloworld_hooks(apr_pool_t *pool)
{
ap_hook_handler(helloworld_handler, NULL, NULL, APR_HOOK_FIRST);
}

这是我的模块主要功能代码

static int helloworld_handler(request_rec *r)
{
  // here I am implementing my all functionality.
}

http.conf文件设置

 <Location /helloworld> 
 SetHandler helloworld 
 </Location>

我希望每次请求到达apache时我的模块都应该自动调用。

0 个答案:

没有答案