mirror of
https://github.com/nginx/nginx.git
synced 2024-12-18 07:37:49 +08:00
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:
parent
ce8183ca7e
commit
ea3aaae636
@ -14,7 +14,6 @@
|
|||||||
|
|
||||||
#define NGX_HTTP_SSI_ADD_PREFIX 1
|
#define NGX_HTTP_SSI_ADD_PREFIX 1
|
||||||
#define NGX_HTTP_SSI_ADD_ZERO 2
|
#define NGX_HTTP_SSI_ADD_ZERO 2
|
||||||
#define NGX_HTTP_SSI_EXPR_TEST 4
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
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);
|
val = ngx_http_ssi_get_variable(r, &var, key);
|
||||||
|
|
||||||
if (val == NULL) {
|
if (val == NULL) {
|
||||||
vv = ngx_http_get_variable(r, &var, key,
|
vv = ngx_http_get_variable(r, &var, key);
|
||||||
flags & NGX_HTTP_SSI_EXPR_TEST);
|
|
||||||
if (vv == NULL) {
|
if (vv == NULL) {
|
||||||
return NGX_ERROR;
|
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);
|
value = ngx_http_ssi_get_variable(r, var, key);
|
||||||
|
|
||||||
if (value == NULL) {
|
if (value == NULL) {
|
||||||
vv = ngx_http_get_variable(r, var, key, 1);
|
vv = ngx_http_get_variable(r, var, key);
|
||||||
|
|
||||||
if (vv == NULL) {
|
if (vv == NULL) {
|
||||||
return NGX_HTTP_SSI_ERROR;
|
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++;
|
p++;
|
||||||
}
|
}
|
||||||
|
|
||||||
flags = (p == last) ? NGX_HTTP_SSI_EXPR_TEST : 0;
|
flags = 0;
|
||||||
|
|
||||||
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
||||||
"left: \"%V\"", &left);
|
"left: \"%V\"", &left);
|
||||||
|
@ -847,7 +847,7 @@ variable(r, name, value = NULL)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
vv = ngx_http_get_variable(r, &var, hash, 1);
|
vv = ngx_http_get_variable(r, &var, hash);
|
||||||
if (vv == NULL) {
|
if (vv == NULL) {
|
||||||
XSRETURN_UNDEF;
|
XSRETURN_UNDEF;
|
||||||
}
|
}
|
||||||
|
@ -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("server_name"), NULL, ngx_http_variable_server_name, 0, 0, 0 },
|
||||||
|
|
||||||
{ ngx_string("request_method"), NULL,
|
{ 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 },
|
{ 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_variable_value_t *
|
||||||
ngx_http_get_variable(ngx_http_request_t *r, ngx_str_t *name, ngx_uint_t key,
|
ngx_http_get_variable(ngx_http_request_t *r, ngx_str_t *name, ngx_uint_t key)
|
||||||
ngx_uint_t nowarn)
|
|
||||||
{
|
{
|
||||||
ngx_http_variable_t *v;
|
ngx_http_variable_t *v;
|
||||||
ngx_http_variable_value_t *vv;
|
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) {
|
||||||
if (v->flags & NGX_HTTP_VAR_INDEXED) {
|
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 {
|
} 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;
|
vv->not_found = 1;
|
||||||
|
|
||||||
if (nowarn == 0) {
|
|
||||||
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
|
|
||||||
"unknown \"%V\" variable", name);
|
|
||||||
}
|
|
||||||
|
|
||||||
return vv;
|
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) {
|
if (ngx_strncmp(v[i].name.data, "arg_", 4) == 0) {
|
||||||
v[i].get_handler = ngx_http_variable_argument;
|
v[i].get_handler = ngx_http_variable_argument;
|
||||||
v[i].data = (uintptr_t) &v[i].name;
|
v[i].data = (uintptr_t) &v[i].name;
|
||||||
|
v[i].flags = NGX_HTTP_VAR_NOCACHEABLE;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ ngx_http_variable_value_t *ngx_http_get_flushed_variable(ngx_http_request_t *r,
|
|||||||
ngx_uint_t index);
|
ngx_uint_t index);
|
||||||
|
|
||||||
ngx_http_variable_value_t *ngx_http_get_variable(ngx_http_request_t *r,
|
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_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);
|
ngx_str_t *var, ngx_list_part_t *part, size_t prefix);
|
||||||
|
Loading…
Reference in New Issue
Block a user