#define ngx_get_conf(conf_ctx, module) conf_ctx[module.index]
但是到了分支这里,从cycle->conf_ctx变成了r
cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module);
ngx_http_get_module_main_conf这样定义:
#define ngx_http_get_module_main_conf(r, module) \
(r)->main_conf[module.ctx_index]
当分析完用户的请求行为后,又会将分析完的配置定下来,比如虚拟主机如何实现的:
ngx_http_find_virtual_server(r, r->headers_in.server.data, r->headers_in.server.len) {
ngx_hash_key(host, len), host, len);
if (cscf) {
r->srv_conf = cscf->ctx->srv_conf; // 以后直接找r要src_conf获取。
r->loc_conf = cscf->ctx->loc_conf;
}
}
天空行空的一口气写完,本文结束!