首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 互联网 >

nginx模块开发入门(8)-3.3 Handler Installation

2013-09-16 
nginx模块开发入门(八)-3.3 Handler Installation3.3. Handler Installation3.3. Handler的装载Handler的

nginx模块开发入门(八)-3.3 Handler Installation
3.3. Handler Installation
3.3. Handler的装载

     Handler的装载通过往模块启用了的指令的回调函数中添加代码来完成。比如,例子circle gif 中ngx_command_t是这样的:

static char *ngx_http_circle_gif(ngx_conf_t *cf, ngx_command_t *cmd, void *conf){    ngx_http_core_loc_conf_t  *clcf;    clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module);    clcf->handler = ngx_http_circle_gif_handler;    return NGX_CONF_OK;}


     这里可以分为两步:首先,得到当前location的“core”结构体,再分配给它一个 handler。很简单,不是吗?

     我已经把我知道的关于hanler模块的东西全招了,现在可以来说说输出过滤链上的filter模块了。

热点排行