comparison src/http/modules/ngx_http_realip_module.c @ 230:38e7b94d63ac NGINX_0_4_0

nginx 0.4.0 *) Change in internal API: the HTTP modules initialization was moved from the init module phase to the HTTP postconfiguration phase. *) Change: now the request body is not read beforehand for the ngx_http_perl_module: it's required to start the reading using the $r->has_request_body method. *) Feature: the ngx_http_perl_module supports the DECLINED return code. *) Feature: the ngx_http_dav_module supports the incoming "Date" header line for the PUT method. *) Feature: the "ssi" directive is available inside the "if" block. *) Bugfix: a segmentation fault occurred if there was an "index" directive with variables and the first index name was without variables; bug appeared in 0.1.29.
author Igor Sysoev <http://sysoev.ru>
date Wed, 30 Aug 2006 00:00:00 +0400
parents fa32d59d9a15
children 29a6403156b0
comparison
equal deleted inserted replaced
229:1965c8e23be7 230:38e7b94d63ac
28 static char *ngx_http_realip_from(ngx_conf_t *cf, ngx_command_t *cmd, 28 static char *ngx_http_realip_from(ngx_conf_t *cf, ngx_command_t *cmd,
29 void *conf); 29 void *conf);
30 static void *ngx_http_realip_create_loc_conf(ngx_conf_t *cf); 30 static void *ngx_http_realip_create_loc_conf(ngx_conf_t *cf);
31 static char *ngx_http_realip_merge_loc_conf(ngx_conf_t *cf, 31 static char *ngx_http_realip_merge_loc_conf(ngx_conf_t *cf,
32 void *parent, void *child); 32 void *parent, void *child);
33 static ngx_int_t ngx_http_realip_init(ngx_cycle_t *cycle); 33 static ngx_int_t ngx_http_realip_init(ngx_conf_t *cf);
34 34
35 35
36 static ngx_conf_enum_t ngx_http_realip_header[] = { 36 static ngx_conf_enum_t ngx_http_realip_header[] = {
37 { ngx_string("X-Forwarded-For"), 1 }, 37 { ngx_string("X-Forwarded-For"), 1 },
38 { ngx_string("X-Real-IP"), 0 }, 38 { ngx_string("X-Real-IP"), 0 },
61 61
62 62
63 63
64 static ngx_http_module_t ngx_http_realip_module_ctx = { 64 static ngx_http_module_t ngx_http_realip_module_ctx = {
65 NULL, /* preconfiguration */ 65 NULL, /* preconfiguration */
66 NULL, /* postconfiguration */ 66 ngx_http_realip_init, /* postconfiguration */
67 67
68 NULL, /* create main configuration */ 68 NULL, /* create main configuration */
69 NULL, /* init main configuration */ 69 NULL, /* init main configuration */
70 70
71 NULL, /* create server configuration */ 71 NULL, /* create server configuration */
80 NGX_MODULE_V1, 80 NGX_MODULE_V1,
81 &ngx_http_realip_module_ctx, /* module context */ 81 &ngx_http_realip_module_ctx, /* module context */
82 ngx_http_realip_commands, /* module directives */ 82 ngx_http_realip_commands, /* module directives */
83 NGX_HTTP_MODULE, /* module type */ 83 NGX_HTTP_MODULE, /* module type */
84 NULL, /* init master */ 84 NULL, /* init master */
85 ngx_http_realip_init, /* init module */ 85 NULL, /* init module */
86 NULL, /* init process */ 86 NULL, /* init process */
87 NULL, /* init thread */ 87 NULL, /* init thread */
88 NULL, /* exit thread */ 88 NULL, /* exit thread */
89 NULL, /* exit process */ 89 NULL, /* exit process */
90 NULL, /* exit master */ 90 NULL, /* exit master */
248 return NGX_CONF_OK; 248 return NGX_CONF_OK;
249 } 249 }
250 250
251 251
252 static ngx_int_t 252 static ngx_int_t
253 ngx_http_realip_init(ngx_cycle_t *cycle) 253 ngx_http_realip_init(ngx_conf_t *cf)
254 { 254 {
255 ngx_http_handler_pt *h; 255 ngx_http_handler_pt *h;
256 ngx_http_core_main_conf_t *cmcf; 256 ngx_http_core_main_conf_t *cmcf;
257 257
258 cmcf = ngx_http_cycle_get_module_main_conf(cycle, ngx_http_core_module); 258 cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module);
259 259
260 h = ngx_array_push(&cmcf->phases[NGX_HTTP_POST_READ_PHASE].handlers); 260 h = ngx_array_push(&cmcf->phases[NGX_HTTP_POST_READ_PHASE].handlers);
261 if (h == NULL) { 261 if (h == NULL) {
262 return NGX_ERROR; 262 return NGX_ERROR;
263 } 263 }