aboutsummaryrefslogtreecommitdiff
path: root/src/http/ngx_http_request.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2008-09-27 15:08:02 +0000
committerIgor Sysoev <igor@sysoev.ru>2008-09-27 15:08:02 +0000
commit2eec1e1ff2a0b2208efb4a86c40c468076c60d6b (patch)
treea2c4dbf8a55d243f445cd473780930f055fd4ef8 /src/http/ngx_http_request.c
parente52991ecbe61464294afe4d40d462fa96ebe3924 (diff)
downloadnginx-2eec1e1ff2a0b2208efb4a86c40c468076c60d6b.tar.gz
nginx-2eec1e1ff2a0b2208efb4a86c40c468076c60d6b.zip
*) log_subrequest
*) flush variables in access log
Diffstat (limited to 'src/http/ngx_http_request.c')
-rw-r--r--src/http/ngx_http_request.c53
1 files changed, 36 insertions, 17 deletions
diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c
index 3970852ea..7001edb9c 100644
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -47,6 +47,7 @@ static void ngx_http_lingering_close_handler(ngx_event_t *ev);
static ngx_int_t ngx_http_post_action(ngx_http_request_t *r);
static void ngx_http_close_request(ngx_http_request_t *r, ngx_int_t error);
static void ngx_http_request_done(ngx_http_request_t *r, ngx_int_t error);
+static void ngx_http_log_request(ngx_http_request_t *r);
static void ngx_http_close_connection(ngx_connection_t *c);
static u_char *ngx_http_log_error(ngx_log_t *log, u_char *buf, size_t len);
@@ -1774,6 +1775,8 @@ 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;
@@ -1807,6 +1810,11 @@ 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;
}
@@ -1819,6 +1827,10 @@ ngx_http_finalize_request(ngx_http_request_t *r, ngx_int_t rc)
}
}
+ if (clcf->log_subrequest) {
+ ngx_http_log_request(r);
+ }
+
return;
}
@@ -1857,8 +1869,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 (!ngx_terminate
&& !ngx_exiting
&& r->keepalive
@@ -2604,14 +2614,11 @@ ngx_http_close_request(ngx_http_request_t *r, ngx_int_t error)
static void
ngx_http_request_done(ngx_http_request_t *r, ngx_int_t error)
{
- ngx_log_t *log;
- ngx_uint_t i, n;
- struct linger linger;
- ngx_http_cleanup_t *cln;
- ngx_http_log_ctx_t *ctx;
- ngx_http_handler_pt *log_handler;
- ngx_http_core_loc_conf_t *clcf;
- ngx_http_core_main_conf_t *cmcf;
+ ngx_log_t *log;
+ struct linger linger;
+ ngx_http_cleanup_t *cln;
+ ngx_http_log_ctx_t *ctx;
+ ngx_http_core_loc_conf_t *clcf;
log = r->connection->log;
@@ -2646,13 +2653,7 @@ ngx_http_request_done(ngx_http_request_t *r, ngx_int_t error)
log->action = "logging request";
- cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module);
-
- log_handler = cmcf->phases[NGX_HTTP_LOG_PHASE].handlers.elts;
- n = cmcf->phases[NGX_HTTP_LOG_PHASE].handlers.nelts;
- for (i = 0; i < n; i++) {
- log_handler[i](r);
- }
+ ngx_http_log_request(r);
log->action = "closing request";
@@ -2685,6 +2686,24 @@ ngx_http_request_done(ngx_http_request_t *r, ngx_int_t error)
static void
+ngx_http_log_request(ngx_http_request_t *r)
+{
+ ngx_uint_t i, n;
+ ngx_http_handler_pt *log_handler;
+ ngx_http_core_main_conf_t *cmcf;
+
+ cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module);
+
+ log_handler = cmcf->phases[NGX_HTTP_LOG_PHASE].handlers.elts;
+ n = cmcf->phases[NGX_HTTP_LOG_PHASE].handlers.nelts;
+
+ for (i = 0; i < n; i++) {
+ log_handler[i](r);
+ }
+}
+
+
+static void
ngx_http_close_connection(ngx_connection_t *c)
{
ngx_pool_t *pool;