diff options
author | Igor Sysoev <igor@sysoev.ru> | 2008-09-29 13:18:41 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2008-09-29 13:18:41 +0000 |
commit | eb62fa0e73757ac043fba433a9f52df6c5c0a33b (patch) | |
tree | 44f5ebb33f45d7d91fcdbb2c659246ddc344530f | |
parent | 5d1dcce2c53188e1187db722bc0f6ea12789fe5a (diff) | |
download | nginx-eb62fa0e73757ac043fba433a9f52df6c5c0a33b.tar.gz nginx-eb62fa0e73757ac043fba433a9f52df6c5c0a33b.zip |
refactor log_subrequest
-rw-r--r-- | src/http/ngx_http_request.c | 28 | ||||
-rw-r--r-- | src/http/ngx_http_request.h | 1 |
2 files changed, 12 insertions, 17 deletions
diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c index 2be20aa0d..e1f0ae793 100644 --- a/src/http/ngx_http_request.c +++ b/src/http/ngx_http_request.c @@ -1760,6 +1760,17 @@ ngx_http_finalize_request(ngx_http_request_t *r, ngx_int_t rc) return; } + clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); + + if (r != r->main && !r->logged) { + + if (clcf->log_subrequest) { + ngx_http_log_request(r); + } + + r->logged = 1; + } + if (r != r->main || rc == NGX_AGAIN) { if (ngx_http_set_write_handler(r) != NGX_OK) { return; @@ -1775,8 +1786,6 @@ ngx_http_finalize_request(ngx_http_request_t *r, ngx_int_t rc) return; } - clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); - if (r != r->main) { pr = r->parent; @@ -1810,11 +1819,6 @@ ngx_http_finalize_request(ngx_http_request_t *r, ngx_int_t rc) ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0, "http fast subrequest: \"%V?%V\" done", &r->uri, &r->args); - - if (clcf->log_subrequest) { - ngx_http_log_request(r); - } - return; } @@ -1823,18 +1827,8 @@ ngx_http_finalize_request(ngx_http_request_t *r, ngx_int_t rc) "http wake parent request: \"%V?%V\"", &pr->uri, &pr->args); - if (clcf->log_subrequest) { - ngx_http_log_request(r); - } - pr->write_event_handler(pr); } - - return; - } - - if (clcf->log_subrequest) { - ngx_http_log_request(r); } return; diff --git a/src/http/ngx_http_request.h b/src/http/ngx_http_request.h index 636839805..2486ca5c0 100644 --- a/src/http/ngx_http_request.h +++ b/src/http/ngx_http_request.h @@ -464,6 +464,7 @@ struct ngx_http_request_s { unsigned expect_tested:1; unsigned root_tested:1; unsigned done:1; + unsigned logged:1; unsigned utf8:1; unsigned buffered:4; |