mirror of
https://github.com/nginx/nginx.git
synced 2024-11-28 16:39:00 +08:00
change processing variables accessed by SSI and perl module:
*) the indexed variables are always flushed *) never show warning for not found variables
This commit is contained in:
parent
185a5d1726
commit
fa7d06ee4f
@ -14,7 +14,6 @@
|
||||
|
||||
#define NGX_HTTP_SSI_ADD_PREFIX 1
|
||||
#define NGX_HTTP_SSI_ADD_ZERO 2
|
||||
#define NGX_HTTP_SSI_EXPR_TEST 4
|
||||
|
||||
|
||||
typedef struct {
|
||||
@ -1701,8 +1700,7 @@ ngx_http_ssi_evaluate_string(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ctx,
|
||||
val = ngx_http_ssi_get_variable(r, &var, key);
|
||||
|
||||
if (val == NULL) {
|
||||
vv = ngx_http_get_variable(r, &var, key,
|
||||
flags & NGX_HTTP_SSI_EXPR_TEST);
|
||||
vv = ngx_http_get_variable(r, &var, key);
|
||||
if (vv == NULL) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
@ -2110,7 +2108,7 @@ ngx_http_ssi_echo(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ctx,
|
||||
value = ngx_http_ssi_get_variable(r, var, key);
|
||||
|
||||
if (value == NULL) {
|
||||
vv = ngx_http_get_variable(r, var, key, 1);
|
||||
vv = ngx_http_get_variable(r, var, key);
|
||||
|
||||
if (vv == NULL) {
|
||||
return NGX_HTTP_SSI_ERROR;
|
||||
@ -2361,7 +2359,7 @@ ngx_http_ssi_if(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ctx,
|
||||
p++;
|
||||
}
|
||||
|
||||
flags = (p == last) ? NGX_HTTP_SSI_EXPR_TEST : 0;
|
||||
flags = 0;
|
||||
|
||||
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
||||
"left: \"%V\"", &left);
|
||||
|
@ -848,7 +848,7 @@ variable(r, name, value = NULL)
|
||||
|
||||
#endif
|
||||
|
||||
vv = ngx_http_get_variable(r, &var, hash, 1);
|
||||
vv = ngx_http_get_variable(r, &var, hash);
|
||||
if (vv == NULL) {
|
||||
XSRETURN_UNDEF;
|
||||
}
|
||||
|
@ -441,8 +441,7 @@ ngx_http_get_flushed_variable(ngx_http_request_t *r, ngx_uint_t index)
|
||||
|
||||
|
||||
ngx_http_variable_value_t *
|
||||
ngx_http_get_variable(ngx_http_request_t *r, ngx_str_t *name, ngx_uint_t key,
|
||||
ngx_uint_t nowarn)
|
||||
ngx_http_get_variable(ngx_http_request_t *r, ngx_str_t *name, ngx_uint_t key)
|
||||
{
|
||||
ngx_http_variable_t *v;
|
||||
ngx_http_variable_value_t *vv;
|
||||
@ -454,7 +453,7 @@ ngx_http_get_variable(ngx_http_request_t *r, ngx_str_t *name, ngx_uint_t key,
|
||||
|
||||
if (v) {
|
||||
if (v->flags & NGX_HTTP_VAR_INDEXED) {
|
||||
return ngx_http_get_indexed_variable(r, v->index);
|
||||
return ngx_http_get_flushed_variable(r, v->index);
|
||||
|
||||
} else {
|
||||
|
||||
@ -526,11 +525,6 @@ ngx_http_get_variable(ngx_http_request_t *r, ngx_str_t *name, ngx_uint_t key,
|
||||
|
||||
vv->not_found = 1;
|
||||
|
||||
if (nowarn == 0) {
|
||||
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
|
||||
"unknown \"%V\" variable", name);
|
||||
}
|
||||
|
||||
return vv;
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ ngx_http_variable_value_t *ngx_http_get_flushed_variable(ngx_http_request_t *r,
|
||||
ngx_uint_t index);
|
||||
|
||||
ngx_http_variable_value_t *ngx_http_get_variable(ngx_http_request_t *r,
|
||||
ngx_str_t *name, ngx_uint_t key, ngx_uint_t nowarn);
|
||||
ngx_str_t *name, ngx_uint_t key);
|
||||
|
||||
ngx_int_t ngx_http_variable_unknown_header(ngx_http_variable_value_t *v,
|
||||
ngx_str_t *var, ngx_list_part_t *part, size_t prefix);
|
||||
|
Loading…
Reference in New Issue
Block a user