Apache: 如何从代理中调用 "static int lua_handler(request_rec *r)" 函数

大家好,

我正在尝试从 "mod_proxy_wstunnel.c" 中调用 Apache lua 模块,以便利用 mod_lua 的功能。

以下是我的代码 [mod_proxy_wstunnel.c]:

...
#include "#include "../../mod_lua.h"
...
...
static void ap_proxy_http_register_hook(apr_pool_t *p)
{
    proxy_hook_scheme_handler(proxy_wstunnel_handler, NULL, NULL, APR_HOOK_FIRST);
    proxy_hook_canon_handler(proxy_wstunnel_canon, NULL, NULL, APR_HOOK_FIRST);
    ap_hook_handler(lua_handler, NULL, NULL, APR_HOOK_MIDDLE); // 添加的代码行
}

我添加了 ap_hook_handler(lua_handler, NULL, NULL, APR_HOOK_MIDDLE); 这一行代码,以调用 mod_lua 处理程序。

  • static int lua_handler(request_rec *r) 函数位于 httpd-2.4.43/modules/lua/mod_lua.c
  • static void ap_proxy_http_register_hook(apr_pool_t *p) 位于 httpd-2.4.43/modules/proxy/mod_proxy_wstunnel.c

编译时,我遇到了以下错误: mod_proxy_wstunnel.c:19:10: fatal error: ../../mod_lua.h: No such file or directory 19 | #include "../../mod_lua.h"

欢迎任何帮助或想法。 提前感谢您的帮助。

点赞