Apache httpd源代码中的函数ap_run_pre_connection在哪里?

时间:2014-03-04 09:03:18

标签: apache

我正在阅读Apache2.2的源代码,我发现当我使用prefork模块时,它会调用ap_process_connection来处理连接,并在此方法中调用{{1} }。
说到这里,我找不到ap_run_pre_connectionap_run_pre_connection(我找到一个名为AP_DECLARE_HOOK的宏,它将pre_connectionap链接到名称{{1}之前})。
我在哪里可以找到下一步?

1 个答案:

答案 0 :(得分:2)

您可以通过查找ap_hook_pre_connection找到参与此挂钩的模块。

AP_IMPLEMENT_HOOK_RUN_ALL(int,pre_connection,(conn_rec * c,void * csd),(c,csd),OK,DECLINED)

AP_IMPLEMENT_HOOK_RUN_ALL表示将运行多个调用ap_hook_pre_connection()的模块,直到返回错误

/**
 * Implement an Apache core hook that runs until one of the functions
 * returns something other than ok or decline. That return value is
 * then returned from the hook runner. If the hooks run to completion,
 * then ok is returned. Note that if no hook runs it would probably be
 * more correct to return decline, but this currently does not do
 * so. The implementation is called ap_run_<i>name</i>.

ap_run_pre_connection的实际impl只是一个循环注册函数链表的宏。见apr_hooks.h