aboutsummaryrefslogtreecommitdiff
path: root/src/http/ngx_http_request.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/http/ngx_http_request.c')
-rw-r--r--src/http/ngx_http_request.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c
index 7af45c586..43301fdac 100644
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -2357,6 +2357,26 @@ ngx_http_finalize_request(ngx_http_request_t *r, ngx_int_t rc)
}
if (r != r->main) {
+ clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
+
+ if (r->background) {
+ if (!r->logged) {
+ if (clcf->log_subrequest) {
+ ngx_http_log_request(r);
+ }
+
+ r->logged = 1;
+
+ } else {
+ ngx_log_error(NGX_LOG_ALERT, c->log, 0,
+ "subrequest: \"%V?%V\" logged again",
+ &r->uri, &r->args);
+ }
+
+ r->done = 1;
+ ngx_http_finalize_connection(r);
+ return;
+ }
if (r->buffered || r->postponed) {
@@ -2374,9 +2394,6 @@ ngx_http_finalize_request(ngx_http_request_t *r, ngx_int_t rc)
r->main->count--;
if (!r->logged) {
-
- clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
-
if (clcf->log_subrequest) {
ngx_http_log_request(r);
}
@@ -2440,6 +2457,8 @@ ngx_http_finalize_request(ngx_http_request_t *r, ngx_int_t rc)
}
r->done = 1;
+
+ r->read_event_handler = ngx_http_block_reading;
r->write_event_handler = ngx_http_request_empty_handler;
if (!r->post_action) {
@@ -2558,6 +2577,8 @@ ngx_http_finalize_connection(ngx_http_request_t *r)
return;
}
+ r = r->main;
+
if (r->reading_body) {
r->keepalive = 0;
r->lingering_close = 1;