mirror of
https://github.com/nginx/nginx.git
synced 2025-08-05 14:06:16 +08:00
merge r3039, r3145:
access_log fixes: *) strict testing "access_log off" *) allow to log invalid $request in access_log always, before it was logged only if error_log was set to info or debug level
This commit is contained in:
parent
393300584e
commit
13653be34e
@ -837,7 +837,13 @@ ngx_http_log_set_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|||||||
|
|
||||||
if (ngx_strcmp(value[1].data, "off") == 0) {
|
if (ngx_strcmp(value[1].data, "off") == 0) {
|
||||||
llcf->off = 1;
|
llcf->off = 1;
|
||||||
return NGX_CONF_OK;
|
if (cf->args->nelts == 2) {
|
||||||
|
return NGX_CONF_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
||||||
|
"invalid parameter \"%V\"", &value[2]);
|
||||||
|
return NGX_CONF_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (llcf->logs == NULL) {
|
if (llcf->logs == NULL) {
|
||||||
|
@ -25,6 +25,8 @@ static ngx_int_t ngx_http_variable_unknown_header_in(ngx_http_request_t *r,
|
|||||||
ngx_http_variable_value_t *v, uintptr_t data);
|
ngx_http_variable_value_t *v, uintptr_t data);
|
||||||
static ngx_int_t ngx_http_variable_unknown_header_out(ngx_http_request_t *r,
|
static ngx_int_t ngx_http_variable_unknown_header_out(ngx_http_request_t *r,
|
||||||
ngx_http_variable_value_t *v, uintptr_t data);
|
ngx_http_variable_value_t *v, uintptr_t data);
|
||||||
|
static ngx_int_t ngx_http_variable_request_line(ngx_http_request_t *r,
|
||||||
|
ngx_http_variable_value_t *v, uintptr_t data);
|
||||||
static ngx_int_t ngx_http_variable_cookie(ngx_http_request_t *r,
|
static ngx_int_t ngx_http_variable_cookie(ngx_http_request_t *r,
|
||||||
ngx_http_variable_value_t *v, uintptr_t data);
|
ngx_http_variable_value_t *v, uintptr_t data);
|
||||||
static ngx_int_t ngx_http_variable_argument(ngx_http_request_t *r,
|
static ngx_int_t ngx_http_variable_argument(ngx_http_request_t *r,
|
||||||
@ -164,8 +166,7 @@ static ngx_http_variable_t ngx_http_core_variables[] = {
|
|||||||
offsetof(ngx_http_request_t, uri),
|
offsetof(ngx_http_request_t, uri),
|
||||||
NGX_HTTP_VAR_NOCACHEABLE, 0 },
|
NGX_HTTP_VAR_NOCACHEABLE, 0 },
|
||||||
|
|
||||||
{ ngx_string("request"), NULL, ngx_http_variable_request,
|
{ ngx_string("request"), NULL, ngx_http_variable_request_line, 0, 0, 0 },
|
||||||
offsetof(ngx_http_request_t, request_line), 0, 0 },
|
|
||||||
|
|
||||||
{ ngx_string("document_root"), NULL,
|
{ ngx_string("document_root"), NULL,
|
||||||
ngx_http_variable_document_root, 0, NGX_HTTP_VAR_NOCACHEABLE, 0 },
|
ngx_http_variable_document_root, 0, NGX_HTTP_VAR_NOCACHEABLE, 0 },
|
||||||
@ -750,6 +751,42 @@ ngx_http_variable_unknown_header(ngx_http_variable_value_t *v, ngx_str_t *var,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static ngx_int_t
|
||||||
|
ngx_http_variable_request_line(ngx_http_request_t *r,
|
||||||
|
ngx_http_variable_value_t *v, uintptr_t data)
|
||||||
|
{
|
||||||
|
u_char *p, *s;
|
||||||
|
|
||||||
|
s = r->request_line.data;
|
||||||
|
|
||||||
|
if (s == NULL) {
|
||||||
|
s = r->request_start;
|
||||||
|
|
||||||
|
if (s == NULL) {
|
||||||
|
v->not_found = 1;
|
||||||
|
return NGX_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (p = s; p < r->header_in->last; p++) {
|
||||||
|
if (*p == CR || *p == LF) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
r->request_line.len = p - s;
|
||||||
|
r->request_line.data = s;
|
||||||
|
}
|
||||||
|
|
||||||
|
v->len = r->request_line.len;
|
||||||
|
v->valid = 1;
|
||||||
|
v->no_cacheable = 0;
|
||||||
|
v->not_found = 0;
|
||||||
|
v->data = s;
|
||||||
|
|
||||||
|
return NGX_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static ngx_int_t
|
static ngx_int_t
|
||||||
ngx_http_variable_cookie(ngx_http_request_t *r, ngx_http_variable_value_t *v,
|
ngx_http_variable_cookie(ngx_http_request_t *r, ngx_http_variable_value_t *v,
|
||||||
uintptr_t data)
|
uintptr_t data)
|
||||||
|
Loading…
Reference in New Issue
Block a user