diff --git a/src/stream.c b/src/stream.c index 355f8d8e6..d497cdfe4 100644 --- a/src/stream.c +++ b/src/stream.c @@ -561,7 +561,7 @@ static int sess_update_st_con_tcp(struct stream *s) * attempts and error reports. */ if (unlikely(si->flags & (SI_FL_EXP|SI_FL_ERR))) { - if (unlikely(req->flags & CF_WRITE_PARTIAL)) { + if (unlikely(req->flags & CF_WROTE_DATA)) { /* Some data were sent past the connection establishment, * so we need to pretend we're established to log correctly * and let later states handle the failure. @@ -587,7 +587,7 @@ static int sess_update_st_con_tcp(struct stream *s) } /* OK, maybe we want to abort */ - if (!(req->flags & CF_WRITE_PARTIAL) && + if (!(req->flags & CF_WROTE_DATA) && unlikely((rep->flags & CF_SHUTW) || ((req->flags & CF_SHUTW_NOW) && /* FIXME: this should not prevent a connection from establishing */ ((!(req->flags & CF_WRITE_ACTIVITY) && channel_is_empty(req)) || diff --git a/src/stream_interface.c b/src/stream_interface.c index c3e2c5395..93772119d 100644 --- a/src/stream_interface.c +++ b/src/stream_interface.c @@ -496,6 +496,10 @@ void stream_int_notify(struct stream_interface *si) * the buffer is full. We must not stop based on input data alone because * an HTTP parser might need more data to complete the parsing. */ + + /* ensure it's only set if a write attempt has succeeded */ + ic->flags &= ~CF_WRITE_PARTIAL; + if (!channel_is_empty(ic) && (si_opposite(si)->flags & SI_FL_WAIT_DATA) && (ic->buf->i == 0 || ic->pipe)) { @@ -610,6 +614,9 @@ static void si_conn_send(struct connection *conn) struct channel *oc = si_oc(si); int ret; + /* ensure it's only set if a write attempt has succeeded */ + oc->flags &= ~CF_WRITE_PARTIAL; + if (oc->pipe && conn->xprt->snd_pipe) { ret = conn->xprt->snd_pipe(conn, oc->pipe); if (ret > 0) @@ -936,6 +943,9 @@ static void stream_int_chk_snd_conn(struct stream_interface *si) struct channel *oc = si_oc(si); struct connection *conn = __objt_conn(si->end); + /* ensure it's only set if a write attempt has succeeded */ + oc->flags &= ~CF_WRITE_PARTIAL; + if (unlikely(si->state > SI_ST_EST || (oc->flags & CF_SHUTW))) return;