diff options
author | Igor Sysoev <igor@sysoev.ru> | 2009-09-21 15:55:56 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2009-09-21 15:55:56 +0000 |
commit | 5b6b1fda1c7e5ad6b5713b157e57f9ee9196fa35 (patch) | |
tree | 83e14e56834e2443d5ef20bfef0d47a5930ef7e6 /src/http/ngx_http_variables.c | |
parent | a8d3d2204f46174c9080280e72d4730212f0efbc (diff) | |
download | nginx-5b6b1fda1c7e5ad6b5713b157e57f9ee9196fa35.tar.gz nginx-5b6b1fda1c7e5ad6b5713b157e57f9ee9196fa35.zip |
allow to log invalid $request in access_log always,
before it was logged only if error_log was set to info or debug level
Diffstat (limited to 'src/http/ngx_http_variables.c')
-rw-r--r-- | src/http/ngx_http_variables.c | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/src/http/ngx_http_variables.c b/src/http/ngx_http_variables.c index d41b996c6..b25e64889 100644 --- a/src/http/ngx_http_variables.c +++ b/src/http/ngx_http_variables.c @@ -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); static ngx_int_t ngx_http_variable_unknown_header_out(ngx_http_request_t *r, 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, ngx_http_variable_value_t *v, uintptr_t data); 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), NGX_HTTP_VAR_NOCACHEABLE, 0 }, - { ngx_string("request"), NULL, ngx_http_variable_request, - offsetof(ngx_http_request_t, request_line), 0, 0 }, + { ngx_string("request"), NULL, ngx_http_variable_request_line, 0, 0, 0 }, { ngx_string("document_root"), NULL, ngx_http_variable_document_root, 0, NGX_HTTP_VAR_NOCACHEABLE, 0 }, @@ -751,6 +752,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 ngx_http_variable_cookie(ngx_http_request_t *r, ngx_http_variable_value_t *v, uintptr_t data) { |