comparison src/http/modules/ngx_http_userid_filter_module.c @ 3659:7e69af2dd93c

set uid values for main request only
author Igor Sysoev <igor@sysoev.ru>
date Wed, 30 Jun 2010 13:15:20 +0000
parents fd6f0f1a9055
children 8649a0c0f09d
comparison
equal deleted inserted replaced
3658:99b2da73c29d 3659:7e69af2dd93c
246 if (conf->enable == NGX_HTTP_USERID_OFF) { 246 if (conf->enable == NGX_HTTP_USERID_OFF) {
247 v->not_found = 1; 247 v->not_found = 1;
248 return NGX_OK; 248 return NGX_OK;
249 } 249 }
250 250
251 ctx = ngx_http_userid_get_uid(r, conf); 251 ctx = ngx_http_userid_get_uid(r->main, conf);
252 252
253 if (ctx == NULL) { 253 if (ctx == NULL) {
254 return NGX_ERROR; 254 return NGX_ERROR;
255 } 255 }
256 256
257 if (ctx->uid_got[3] != 0) { 257 if (ctx->uid_got[3] != 0) {
258 return ngx_http_userid_variable(r, v, &conf->name, ctx->uid_got); 258 return ngx_http_userid_variable(r->main, v, &conf->name, ctx->uid_got);
259 } 259 }
260 260
261 v->not_found = 1; 261 v->not_found = 1;
262 262
263 return NGX_OK; 263 return NGX_OK;
269 ngx_http_variable_value_t *v, uintptr_t data) 269 ngx_http_variable_value_t *v, uintptr_t data)
270 { 270 {
271 ngx_http_userid_ctx_t *ctx; 271 ngx_http_userid_ctx_t *ctx;
272 ngx_http_userid_conf_t *conf; 272 ngx_http_userid_conf_t *conf;
273 273
274 conf = ngx_http_get_module_loc_conf(r, ngx_http_userid_filter_module); 274 conf = ngx_http_get_module_loc_conf(r->main, ngx_http_userid_filter_module);
275 275
276 if (conf->enable < NGX_HTTP_USERID_V1) { 276 if (conf->enable < NGX_HTTP_USERID_V1) {
277 v->not_found = 1; 277 v->not_found = 1;
278 return NGX_OK; 278 return NGX_OK;
279 } 279 }
280 280
281 ctx = ngx_http_userid_get_uid(r, conf); 281 ctx = ngx_http_userid_get_uid(r->main, conf);
282 282
283 if (ctx == NULL) { 283 if (ctx == NULL) {
284 return NGX_ERROR; 284 return NGX_ERROR;
285 } 285 }
286 286
289 if (ctx->uid_got[3] != 0) { 289 if (ctx->uid_got[3] != 0) {
290 v->not_found = 1; 290 v->not_found = 1;
291 return NGX_OK; 291 return NGX_OK;
292 } 292 }
293 293
294 if (ngx_http_userid_create_uid(r, ctx, conf) != NGX_OK) { 294 if (ngx_http_userid_create_uid(r->main, ctx, conf) != NGX_OK) {
295 return NGX_ERROR; 295 return NGX_ERROR;
296 } 296 }
297 } 297 }
298 298
299 return ngx_http_userid_variable(r, v, &conf->name, ctx->uid_set); 299 return ngx_http_userid_variable(r->main, v, &conf->name, ctx->uid_set);
300 } 300 }
301 301
302 302
303 static ngx_http_userid_ctx_t * 303 static ngx_http_userid_ctx_t *
304 ngx_http_userid_get_uid(ngx_http_request_t *r, ngx_http_userid_conf_t *conf) 304 ngx_http_userid_get_uid(ngx_http_request_t *r, ngx_http_userid_conf_t *conf)