diff --git a/src/stconn.c b/src/stconn.c index 27544645c..273a1d894 100644 --- a/src/stconn.c +++ b/src/stconn.c @@ -512,6 +512,10 @@ struct appctx *sc_applet_create(struct stconn *sc, struct applet *app) */ static inline int sc_cond_forward_shut(struct stconn *sc) { + /* Foward the shutdown if an write error occurred on the input channel */ + if (sc_ic(sc)->flags & CF_WRITE_TIMEOUT) + return 1; + /* The close must not be forwarded */ if (!(sc->flags & (SC_FL_EOS|SC_FL_ABRT_DONE)) || !(sc->flags & SC_FL_NOHALF)) return 0; diff --git a/src/stream.c b/src/stream.c index 00a6c07b7..45b0c56d9 100644 --- a/src/stream.c +++ b/src/stream.c @@ -2378,7 +2378,7 @@ struct task *process_stream(struct task *t, void *context, unsigned int state) /* shutdown(write) pending */ if (unlikely((scb->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED)) == SC_FL_SHUT_WANTED && - channel_is_empty(req))) { + (channel_is_empty(req) || (req->flags & CF_WRITE_TIMEOUT)))) { if (scf->flags & SC_FL_ERROR) scb->flags |= SC_FL_NOLINGER; sc_shutdown(scb); @@ -2502,7 +2502,7 @@ struct task *process_stream(struct task *t, void *context, unsigned int state) /* shutdown(write) pending */ if (unlikely((scf->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED)) == SC_FL_SHUT_WANTED && - channel_is_empty(res))) { + (channel_is_empty(res) || (res->flags & CF_WRITE_TIMEOUT)))) { sc_shutdown(scf); }