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
13 | 13 |
|
14 | 14 |
#define NGX_HTTP_SSI_ADD_PREFIX 1
|
15 | 15 |
#define NGX_HTTP_SSI_ADD_ZERO 2
|
16 | |
#define NGX_HTTP_SSI_EXPR_TEST 4
|
17 | 16 |
|
18 | 17 |
|
19 | 18 |
typedef struct {
|
|
1700 | 1699 |
val = ngx_http_ssi_get_variable(r, &var, key);
|
1701 | 1700 |
|
1702 | 1701 |
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);
|
1705 | 1703 |
if (vv == NULL) {
|
1706 | 1704 |
return NGX_ERROR;
|
1707 | 1705 |
}
|
|
2109 | 2107 |
value = ngx_http_ssi_get_variable(r, var, key);
|
2110 | 2108 |
|
2111 | 2109 |
if (value == NULL) {
|
2112 | |
vv = ngx_http_get_variable(r, var, key, 1);
|
|
2110 |
vv = ngx_http_get_variable(r, var, key);
|
2113 | 2111 |
|
2114 | 2112 |
if (vv == NULL) {
|
2115 | 2113 |
return NGX_HTTP_SSI_ERROR;
|
|
2360 | 2358 |
p++;
|
2361 | 2359 |
}
|
2362 | 2360 |
|
2363 | |
flags = (p == last) ? NGX_HTTP_SSI_EXPR_TEST : 0;
|
|
2361 |
flags = 0;
|
2364 | 2362 |
|
2365 | 2363 |
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
2366 | 2364 |
"left: \"%V\"", &left);
|
440 | 440 |
|
441 | 441 |
|
442 | 442 |
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)
|
445 | 444 |
{
|
446 | 445 |
ngx_http_variable_t *v;
|
447 | 446 |
ngx_http_variable_value_t *vv;
|
|
453 | 452 |
|
454 | 453 |
if (v) {
|
455 | 454 |
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);
|
457 | 456 |
|
458 | 457 |
} else {
|
459 | 458 |
|
|
524 | 523 |
}
|
525 | 524 |
|
526 | 525 |
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 | |
}
|
532 | 526 |
|
533 | 527 |
return vv;
|
534 | 528 |
}
|
49 | 49 |
ngx_uint_t index);
|
50 | 50 |
|
51 | 51 |
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);
|
53 | 53 |
|
54 | 54 |
ngx_int_t ngx_http_variable_unknown_header(ngx_http_variable_value_t *v,
|
55 | 55 |
ngx_str_t *var, ngx_list_part_t *part, size_t prefix);
|