diff src/event/ngx_event_pipe.c @ 132:91372f004adf NGINX_0_3_13

nginx 0.3.13 *) Feature: the IMAP/POP3 proxy supports STARTTLS and STLS. *) Bugfix: the IMAP/POP3 proxy did not work with the select, poll, and /dev/poll methods. *) Bugfix: in SSI handling. *) Bugfix: now Solaris sendfilev() is not used to transfer the client request body to FastCGI-server via the unix domain socket. *) Bugfix: the "auth_basic" directive did not disable the authorization; bug appeared in 0.3.11.
author Igor Sysoev <http://sysoev.ru>
date Mon, 05 Dec 2005 00:00:00 +0300
parents 82d695e3d662
children 3656228c0b56
line wrap: on
line diff
--- a/src/event/ngx_event_pipe.c
+++ b/src/event/ngx_event_pipe.c
@@ -407,12 +407,15 @@ ngx_event_pipe_read_upstream(ngx_event_p
 static ngx_int_t
 ngx_event_pipe_write_to_downstream(ngx_event_pipe_t *p)
 {
-    size_t        bsize;
-    ngx_uint_t    flush;
-    ngx_chain_t  *out, **ll, *cl;
+    size_t             bsize;
+    ngx_uint_t         flush;
+    ngx_chain_t       *out, **ll, *cl;
+    ngx_connection_t  *downstream;
+
+    downstream = p->downstream;
 
     ngx_log_debug1(NGX_LOG_DEBUG_EVENT, p->log, 0,
-                   "pipe write downstream: %d", p->downstream->write->ready);
+                   "pipe write downstream: %d", downstream->write->ready);
 
     for ( ;; ) {
         if (p->downstream_error) {
@@ -452,6 +455,11 @@ ngx_event_pipe_write_to_downstream(ngx_e
                 }
 
                 if (p->output_filter(p->output_ctx, p->in) == NGX_ERROR) {
+
+                    if (downstream->destroyed) {
+                        return NGX_ABORT;
+                    }
+
                     p->downstream_error = 1;
                     return ngx_event_pipe_drain_chains(p);
                 }
@@ -468,9 +476,9 @@ ngx_event_pipe_write_to_downstream(ngx_e
             break;
         }
 
-        if (p->downstream->data != p->output_ctx
-            || !p->downstream->write->ready
-            || p->downstream->write->delayed)
+        if (downstream->data != p->output_ctx
+            || !downstream->write->ready
+            || downstream->write->delayed)
         {
             break;
         }