diff src/http/ngx_http_request.c @ 146:36af50a5582d NGINX_0_3_20

nginx 0.3.20 *) Bugfix: in SSI handling. *) Bugfix: the ngx_http_memcached_module did not support the keys in the "/usr?args" form.
author Igor Sysoev <http://sysoev.ru>
date Wed, 11 Jan 2006 00:00:00 +0300
parents 84910468f6de
children bb61aa162c6b
line wrap: on
line diff
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -1423,7 +1423,7 @@ ngx_http_finalize_request(ngx_http_reque
             return;
         }
 
-        if (r->main == r) {
+        if (r == r->main) {
             if (r->connection->read->timer_set) {
                 ngx_del_timer(r->connection->read);
             }
@@ -1438,7 +1438,7 @@ ngx_http_finalize_request(ngx_http_reque
         return;
     }
 
-    if (r->main != r || rc == NGX_AGAIN) {
+    if (r != r->main || rc == NGX_AGAIN) {
         if (ngx_http_set_write_handler(r) != NGX_OK) {
             return;
         }
@@ -1453,7 +1453,7 @@ ngx_http_finalize_request(ngx_http_reque
         return;
     }
 
-    if (r->main != r) {
+    if (r != r->main) {
 
         pr = r->parent;
 
@@ -1461,7 +1461,7 @@ ngx_http_finalize_request(ngx_http_reque
                        "http parent request: \"%V?%V\"", &pr->uri, &pr->args);
 
         if (rc != NGX_AGAIN) {
-            pr->connection->data = pr;
+            r->connection->data = pr;
         }
 
         if (pr->postponed) {
@@ -1472,13 +1472,23 @@ ngx_http_finalize_request(ngx_http_reque
 
             if (rc != NGX_AGAIN && pr->postponed->request == r) {
                 pr->postponed = pr->postponed->next;
-
-                if (pr->postponed == NULL) {
-                    return;
-                }
+            }
+
+            if (r->fast_subrequest) {
+                ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
+                           "http fast subrequest: \"%V?%V\" done",
+                           &r->uri, &r->args);
+                return;
             }
 
             ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
+                           "http wake parent request: \"%V?%V\"",
+                           &pr->uri, &pr->args);
+
+            pr->write_event_handler(pr);
+
+#if 0
+            ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
                            "http request: \"%V?%V\" still has postponed",
                            &pr->uri, &pr->args);
 
@@ -1489,6 +1499,8 @@ ngx_http_finalize_request(ngx_http_reque
 
                 pr->write_event_handler(pr);
             }
+#endif
+
         }
 
         return;
@@ -1498,7 +1510,7 @@ ngx_http_finalize_request(ngx_http_reque
         return;
     }
 
-    if (r->out) {
+    if (r->connection->buffered) {
         (void) ngx_http_set_write_handler(r);
         return;
     }
@@ -1655,7 +1667,11 @@ ngx_http_writer(ngx_http_request_t *r)
             ngx_http_close_request(r, 0);
         }
 
-        return;
+        if (r == r->main) {
+            return;
+        }
+
+        rc = NGX_OK;
     }
 
     ngx_log_debug2(NGX_LOG_DEBUG_HTTP, wev->log, 0,
@@ -1691,7 +1707,7 @@ ngx_http_discard_body(ngx_http_request_t
     ssize_t       size;
     ngx_event_t  *rev;
 
-    if (r->main != r) {
+    if (r != r->main) {
         return NGX_OK;
     }