Klaus Demo nginx / fa7d06e
change processing variables accessed by SSI and perl module: *) the indexed variables are always flushed *) never show warning for not found variables Igor Sysoev 12 years ago
4 changed file(s) with 7 addition(s) and 15 deletion(s). Raw diff Collapse all Expand all
1313
1414 #define NGX_HTTP_SSI_ADD_PREFIX 1
1515 #define NGX_HTTP_SSI_ADD_ZERO 2
16 #define NGX_HTTP_SSI_EXPR_TEST 4
1716
1817
1918 typedef struct {
17001699 val = ngx_http_ssi_get_variable(r, &var, key);
17011700
17021701 if (val == NULL) {
1703 vv = ngx_http_get_variable(r, &var, key,
1704 flags & NGX_HTTP_SSI_EXPR_TEST);
1702 vv = ngx_http_get_variable(r, &var, key);
17051703 if (vv == NULL) {
17061704 return NGX_ERROR;
17071705 }
21092107 value = ngx_http_ssi_get_variable(r, var, key);
21102108
21112109 if (value == NULL) {
2112 vv = ngx_http_get_variable(r, var, key, 1);
2110 vv = ngx_http_get_variable(r, var, key);
21132111
21142112 if (vv == NULL) {
21152113 return NGX_HTTP_SSI_ERROR;
23602358 p++;
23612359 }
23622360
2363 flags = (p == last) ? NGX_HTTP_SSI_EXPR_TEST : 0;
2361 flags = 0;
23642362
23652363 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
23662364 "left: \"%V\"", &left);
847847
848848 #endif
849849
850 vv = ngx_http_get_variable(r, &var, hash, 1);
850 vv = ngx_http_get_variable(r, &var, hash);
851851 if (vv == NULL) {
852852 XSRETURN_UNDEF;
853853 }
440440
441441
442442 ngx_http_variable_value_t *
443 ngx_http_get_variable(ngx_http_request_t *r, ngx_str_t *name, ngx_uint_t key,
444 ngx_uint_t nowarn)
443 ngx_http_get_variable(ngx_http_request_t *r, ngx_str_t *name, ngx_uint_t key)
445444 {
446445 ngx_http_variable_t *v;
447446 ngx_http_variable_value_t *vv;
453452
454453 if (v) {
455454 if (v->flags & NGX_HTTP_VAR_INDEXED) {
456 return ngx_http_get_indexed_variable(r, v->index);
455 return ngx_http_get_flushed_variable(r, v->index);
457456
458457 } else {
459458
524523 }
525524
526525 vv->not_found = 1;
527
528 if (nowarn == 0) {
529 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
530 "unknown \"%V\" variable", name);
531 }
532526
533527 return vv;
534528 }
4949 ngx_uint_t index);
5050
5151 ngx_http_variable_value_t *ngx_http_get_variable(ngx_http_request_t *r,
52 ngx_str_t *name, ngx_uint_t key, ngx_uint_t nowarn);
52 ngx_str_t *name, ngx_uint_t key);
5353
5454 ngx_int_t ngx_http_variable_unknown_header(ngx_http_variable_value_t *v,
5555 ngx_str_t *var, ngx_list_part_t *part, size_t prefix);