Mercurial > hg > nginx
comparison src/http/ngx_http_variables.c @ 3500:0eb46e3c5c02
change processing variables accessed by SSI and perl module:
*) the indexed variables are always flushed
*) never show warning for not found variables
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Thu, 22 Apr 2010 14:02:45 +0000 |
parents | b4a14d50388b |
children | dd1570b6f237 |
comparison
equal
deleted
inserted
replaced
3499:b4a14d50388b | 3500:0eb46e3c5c02 |
---|---|
439 return ngx_http_get_indexed_variable(r, index); | 439 return ngx_http_get_indexed_variable(r, index); |
440 } | 440 } |
441 | 441 |
442 | 442 |
443 ngx_http_variable_value_t * | 443 ngx_http_variable_value_t * |
444 ngx_http_get_variable(ngx_http_request_t *r, ngx_str_t *name, ngx_uint_t key, | 444 ngx_http_get_variable(ngx_http_request_t *r, ngx_str_t *name, ngx_uint_t key) |
445 ngx_uint_t nowarn) | |
446 { | 445 { |
447 ngx_http_variable_t *v; | 446 ngx_http_variable_t *v; |
448 ngx_http_variable_value_t *vv; | 447 ngx_http_variable_value_t *vv; |
449 ngx_http_core_main_conf_t *cmcf; | 448 ngx_http_core_main_conf_t *cmcf; |
450 | 449 |
452 | 451 |
453 v = ngx_hash_find(&cmcf->variables_hash, key, name->data, name->len); | 452 v = ngx_hash_find(&cmcf->variables_hash, key, name->data, name->len); |
454 | 453 |
455 if (v) { | 454 if (v) { |
456 if (v->flags & NGX_HTTP_VAR_INDEXED) { | 455 if (v->flags & NGX_HTTP_VAR_INDEXED) { |
457 return ngx_http_get_indexed_variable(r, v->index); | 456 return ngx_http_get_flushed_variable(r, v->index); |
458 | 457 |
459 } else { | 458 } else { |
460 | 459 |
461 vv = ngx_palloc(r->pool, sizeof(ngx_http_variable_value_t)); | 460 vv = ngx_palloc(r->pool, sizeof(ngx_http_variable_value_t)); |
462 | 461 |
523 | 522 |
524 return NULL; | 523 return NULL; |
525 } | 524 } |
526 | 525 |
527 vv->not_found = 1; | 526 vv->not_found = 1; |
528 | |
529 if (nowarn == 0) { | |
530 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | |
531 "unknown \"%V\" variable", name); | |
532 } | |
533 | 527 |
534 return vv; | 528 return vv; |
535 } | 529 } |
536 | 530 |
537 | 531 |