comparison src/http/modules/ngx_http_userid_filter_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 fbf2b2f66c9f
comparison
equal deleted inserted replaced
229:1965c8e23be7 230:38e7b94d63ac
57 57
58 static ngx_int_t ngx_http_userid_add_variables(ngx_conf_t *cf); 58 static ngx_int_t ngx_http_userid_add_variables(ngx_conf_t *cf);
59 static ngx_int_t ngx_http_userid_variable(ngx_http_request_t *r, 59 static ngx_int_t ngx_http_userid_variable(ngx_http_request_t *r,
60 ngx_http_variable_value_t *v, uintptr_t data); 60 ngx_http_variable_value_t *v, uintptr_t data);
61 61
62 static ngx_int_t ngx_http_userid_init(ngx_cycle_t *cycle); 62 static ngx_int_t ngx_http_userid_init(ngx_conf_t *cf);
63 static void *ngx_http_userid_create_conf(ngx_conf_t *cf); 63 static void *ngx_http_userid_create_conf(ngx_conf_t *cf);
64 static char *ngx_http_userid_merge_conf(ngx_conf_t *cf, void *parent, 64 static char *ngx_http_userid_merge_conf(ngx_conf_t *cf, void *parent,
65 void *child); 65 void *child);
66 static char *ngx_http_userid_domain(ngx_conf_t *cf, void *post, void *data); 66 static char *ngx_http_userid_domain(ngx_conf_t *cf, void *post, void *data);
67 static char *ngx_http_userid_path(ngx_conf_t *cf, void *post, void *data); 67 static char *ngx_http_userid_path(ngx_conf_t *cf, void *post, void *data);
160 }; 160 };
161 161
162 162
163 static ngx_http_module_t ngx_http_userid_filter_module_ctx = { 163 static ngx_http_module_t ngx_http_userid_filter_module_ctx = {
164 ngx_http_userid_add_variables, /* preconfiguration */ 164 ngx_http_userid_add_variables, /* preconfiguration */
165 NULL, /* postconfiguration */ 165 ngx_http_userid_init, /* postconfiguration */
166 166
167 NULL, /* create main configuration */ 167 NULL, /* create main configuration */
168 NULL, /* init main configuration */ 168 NULL, /* init main configuration */
169 169
170 NULL, /* create server configuration */ 170 NULL, /* create server configuration */
179 NGX_MODULE_V1, 179 NGX_MODULE_V1,
180 &ngx_http_userid_filter_module_ctx, /* module context */ 180 &ngx_http_userid_filter_module_ctx, /* module context */
181 ngx_http_userid_commands, /* module directives */ 181 ngx_http_userid_commands, /* module directives */
182 NGX_HTTP_MODULE, /* module type */ 182 NGX_HTTP_MODULE, /* module type */
183 NULL, /* init master */ 183 NULL, /* init master */
184 ngx_http_userid_init, /* init module */ 184 NULL, /* init module */
185 NULL, /* init process */ 185 NULL, /* init process */
186 NULL, /* init thread */ 186 NULL, /* init thread */
187 NULL, /* exit thread */ 187 NULL, /* exit thread */
188 NULL, /* exit process */ 188 NULL, /* exit process */
189 NULL, /* exit master */ 189 NULL, /* exit master */
615 v->no_cachable = 0; 615 v->no_cachable = 0;
616 v->not_found = 0; 616 v->not_found = 0;
617 617
618 ngx_sprintf(v->data, "%V=%08XD%08XD%08XD%08XD", 618 ngx_sprintf(v->data, "%V=%08XD%08XD%08XD%08XD",
619 &conf->name, uid[0], uid[1], uid[2], uid[3]); 619 &conf->name, uid[0], uid[1], uid[2], uid[3]);
620
621 return NGX_OK;
622 }
623
624
625 static ngx_int_t
626 ngx_http_userid_init(ngx_cycle_t *cycle)
627 {
628 ngx_http_next_header_filter = ngx_http_top_header_filter;
629 ngx_http_top_header_filter = ngx_http_userid_filter;
630 620
631 return NGX_OK; 621 return NGX_OK;
632 } 622 }
633 623
634 624
691 681
692 return NGX_CONF_OK; 682 return NGX_CONF_OK;
693 } 683 }
694 684
695 685
686 static ngx_int_t
687 ngx_http_userid_init(ngx_conf_t *cf)
688 {
689 ngx_http_next_header_filter = ngx_http_top_header_filter;
690 ngx_http_top_header_filter = ngx_http_userid_filter;
691
692 return NGX_OK;
693 }
694
695
696 static char * 696 static char *
697 ngx_http_userid_domain(ngx_conf_t *cf, void *post, void *data) 697 ngx_http_userid_domain(ngx_conf_t *cf, void *post, void *data)
698 { 698 {
699 ngx_str_t *domain = data; 699 ngx_str_t *domain = data;
700 700