Hello!


Here is a patch to solve the following problem: When the proxy is turned on, if the downstream error (p->output_filter() returns an error), the current code will still try to read upstream & write downstream, which is actually unnecessary.



# HG changeset patch

# User dapeng.ndp<dapeng.ndp@alibaba-inc.com>

# Date 1532956361 -28800

#      Mon Jul 30 21:12:41 2018 +0800

# Node ID cbacf180df090540846aefa4a4a5453e307be219

# Parent  f7e79596baf209151682f2f7d220161c034657ac

ngx_event_pipe: add judgment conditions for downstream errors.


Avoid writing downstream & reading upstream, if there is an error due to writing downstream.


diff -r f7e79596baf2 -r cbacf180df09 src/event/ngx_event_pipe.c

--- a/src/event/ngx_event_pipe.c        Tue Jul 24 18:46:54 2018 +0300

+++ b/src/event/ngx_event_pipe.c        Mon Jul 30 21:12:41 2018 +0800

@@ -247,6 +247,7 @@

             } else if (!p->cacheable

                        && p->downstream->data == p->output_ctx

                        && p->downstream->write->ready

+                       && !p->downstream_error

                        && !p->downstream->write->delayed)

             {

                 /*