读书人

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

发布时间: 2013-09-16 13:45:21 作者: rapoo

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模块了。

读书人网 >互联网

热点推荐