merge r3464, r3500, r3501:

*) make $request_method non-cacheable
*) make $arg_ variables non-cacheable
*) 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:
Igor Sysoev 2010-06-07 10:26:50 +00:00
parent ce8183ca7e
commit ea3aaae636
4 changed files with 10 additions and 16 deletions

View File

@ -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);

View File

@ -847,7 +847,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;
}

View File

@ -196,7 +196,8 @@ static ngx_http_variable_t ngx_http_core_variables[] = {
{ ngx_string("server_name"), NULL, ngx_http_variable_server_name, 0, 0, 0 },
{ ngx_string("request_method"), NULL,
ngx_http_variable_request_method, 0, 0, 0 },
ngx_http_variable_request_method, 0,
NGX_HTTP_VAR_NOCACHEABLE, 0 },
{ ngx_string("remote_user"), NULL, ngx_http_variable_remote_user, 0, 0, 0 },
@ -440,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;
@ -453,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 {
@ -525,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;
}
@ -1781,6 +1776,7 @@ ngx_http_variables_init_vars(ngx_conf_t *cf)
if (ngx_strncmp(v[i].name.data, "arg_", 4) == 0) {
v[i].get_handler = ngx_http_variable_argument;
v[i].data = (uintptr_t) &v[i].name;
v[i].flags = NGX_HTTP_VAR_NOCACHEABLE;
continue;
}

View File

@ -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);