diff --git a/include/haproxy/sc_strm.h b/include/haproxy/sc_strm.h index 37460703f..3e2bea0bd 100644 --- a/include/haproxy/sc_strm.h +++ b/include/haproxy/sc_strm.h @@ -395,7 +395,19 @@ static inline int sc_is_send_allowed(const struct stconn *sc) if (sc->flags & SC_FL_SHUT_DONE) return 0; - return !sc_ep_test(sc, SE_FL_WAIT_DATA | SE_FL_WONT_CONSUME); + if (!sc_appctx(sc) || !(__sc_appctx(sc)->flags & APPCTX_FL_INOUT_BUFS)) + return !sc_ep_test(sc, SE_FL_WAIT_DATA | SE_FL_WONT_CONSUME); + + if (sc_ep_test(sc, SE_FL_WONT_CONSUME)) + return 0; + + if (sc_ep_test(sc, SE_FL_WAIT_DATA)) { + if (__sc_appctx(sc)->flags & (APPCTX_FL_INBLK_FULL|APPCTX_FL_INBLK_ALLOC)) + return 0; + if (!co_data(sc_oc(sc))) + return 0; + } + return 1; } static inline int sc_rcv_may_expire(const struct stconn *sc)