Apache 的hook 一览
来源:互联网 发布:jsp网上商城源码下载 编辑:程序博客网 时间:2024/05/18 20:12
看了一个日本人总结的Apache的钩子函数一览,我觉得对于Apache模块开发的童鞋挺有用的,就搬过来了。
本章的重要内容:- 关于hook的调用顺序
- 钩子函数的调用顺序是:「设定的初期化」「进程的初期化」「连接」「请求」
- 关于RUN_ALL,RUN_FIRST
- RUN_FIRST 类型的hook 是:被调用的 hook函数的返回值为 OK 或者是
DECLINE(出错)时,后面的hook是不被执行的。 - RUN_ALL 类型的hook 是:被调用的 hook函数的返回值不为
DECLINE(出错)时,已经加载的hook将被全部执行。 - 关于hook 登録函数 ap_hook_xxx() 的参数
- ap_hook_xxx() 的参数全部相同.具体的请参照下面.
Index
説明
int x_pre_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp)returnOK or DECLINED on success anything else is a errorpconfThe config poolplogThe logging streams poolptempThe temporary pool
int x_open_logs(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s)returnOK or DECLINED on success anything else is a errorpconfThe config poolplogThe logging streams poolptempThe temporary poolsThe list of server_recs
int x_post_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s)returnOK or DECLINED on success anything else is a errorpconfThe config poolplogThe logging streams poolptempThe temporary poolsThe list of server_recs
void x_optional_fn_retrieve(void)
int x_pre_mpm(apr_pool_t *p, ap_scoreboard_e sb_type)returnOK or DECLINE on success; anything else is a errorpApache pool to allocate from.sb_type
void x_child_init(apr_pool_t *pchild, server_rec *s)pchildThe child poolsThe list of server_recs in this server
conn_rec * x_create_connection(apr_pool_t *p, server_rec *server, apr_socket_t *csd, long conn_id, void *sbh, apr_bucket_alloc_t *alloc)returnAn allocated connection record or NULL.server pThe pool from which to allocate the connection recordcsdThe socket that has been acceptedconn_idA unique identifier for this connection. The ID only needs to be unique at that time, not forever.sbhA handle to scoreboard information for this connection.alloc
Apache の付属文書によれば,accept()直後に呼ばれる
int x_pre_connection(conn_rec *c, void *csd)returnOK or DECLINEDcThe connection on which the request has been received.csdThe mechanism on which this connection is to be read. Most times this will be a socket, but it is up to the module that accepts the request to determine the exact type.
int x_process_connection(conn_rec *c)returnOK or DECLINEDcThe connection on which the request has been received.
int x_create_request(request_rec *r)returnOK or DECLINEDrThe current request
int x_post_read_request(request_rec *r)returnOK or DECLINEDrThe current request
Apache の付属文書によれば,キャッシュモジュールが使用している.
int x_quick_handler(request_rec *r, int lookup_uri)rThe request_reclookup_uriControls whether the caller actually wants content or not. lookup is set when the quick_handler is called out of ap_sub_req_lookup_uri()
int x_translate_name(request_rec *r)returnOK, DECLINED, or HTTP_...rThe current request
int x_map_to_storage(request_rec *r)returnDONE (or HTTP_) if this contextless request was just fulfilled (such as TRACE), OK if this is not a file, and DECLINED if this is a file. The core map_to_storage (HOOK_RUN_REALLY_LAST) will directory_walk and file_walk the r->filename.rThe current request
int x_header_parser(request_rec *r)returnOK or DECLINEDrThe current request
int x_access_checker(request_rec *r)returnOK, DECLINED, or HTTP_...rthe current request
int x_check_user_id(request_rec *r)returnOK, DECLINED, or HTTP_...rThe current request
int x_auth_checker(request_rec *r)returnOK, DECLINED, or HTTP_...rthe current request
int x_type_checker(request_rec *r)returnOK, DECLINED, or HTTP_...rthe current request
int x_fixups(request_rec *r)returnOK, DECLINED, or HTTP_...rThe current request
void x_insert_filter(request_rec *r)rthe current request
int x_handler(request_rec *r)rThe request_rec
int x_log_transaction(request_rec *r)returnOK, DECLINED, or HTTP_...rThe current request
void x_insert_error_filter(request_rec *r)rthe current request
void x_error_log(const char *file, int line, int level, apr_status_t status, const server_rec *s, const request_rec *r, apr_pool_t *pool, const char *errstr)
apr_port_t x_default_port(const request_rec *r)returnThe current portrThe current request
ここで言う"method" は scheme の間違いのようです.実際,Apache 2.2 では ap_hook_http_scheme() に変更されています.
const char * x_http_method(const request_rec *r)returnThe http method from the requestrThe current request
int x_fatal_exception(ap_exception_info_t *ei)
int x_get_mgmt_items(apr_pool_t *p, const char * val, apr_hash_t *ht)pA pool to use to create entries in the hash tablevalThe name of the parameter(s) that is wanted. This is tree-structured would be in the form ('*' is all the tree, 'module.*' all of the module , 'module.foo.*', or 'module.foo.bar' )htThe hash table to store the results. Keys are item names, and the values point to ap_mgmt_item_t structures.
ap_unix_identity_t * x_get_suexec_identity(const request_rec *r)
- Apache 的hook 一览
- Apache 的hook 一览
- Apache 的hook 一览
- Apache mod_rewrite规则重写的标志一览
- Apache Tomcat 版本与JVM版本的官方一致性一览
- 2.6内核中netfilter hook点一览
- 2.6内核中netfilter hook点一览
- Apache Hook 结构分析
- apache挂钩(HOOK)
- Apache Spark 1.5发布,新特性一览
- Apache CloudStack 4.5.2 新特性一览
- Apache Hook机制解析(下)——实战:在自己的代码中使用Apache的钩子
- Apache Hook机制解析(下)——实战:在自己的代码中使用Apache的钩子
- Apache Hook机制解析(上)——钩子机制的实现
- Apache Hook机制解析(上)——钩子机制的实现
- apache编程思想--挂钩(HOOK)
- Resin的配置文件一览
- Resin的配置文件一览
- 如何为vmware下的虚拟机扩充硬盘
- java 获取文件夹大小、文件大小、文件个数
- Replacing JSON Libraries in Delphi REST Servers
- javascript中的对象、方法的相关解释
- putty ssh登陆centos linux中文乱码解决方案
- Apache 的hook 一览
- 用SVG和VML开发工作流设计器
- 面向对象设计模式之Builder生成器模式(创建型)
- 简单的倒计时
- 51单片机控制四相步进电机
- linux-2.6.31/arch/arm/下的故事
- 由二叉树的前序遍历序列和中序遍历序列求后序遍历序列
- Oracle RAC Failover 详解
- jQuery语法