From 9279562e2aa985e8d232b756b7afe24e835e306e Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Fri, 6 Mar 2009 12:51:23 +0100 Subject: [PATCH] [BUG] switch server-side stream interface to close in case of abort In pure TCP mode, there is no response analyser to switch the server-side stream interface from INI to CLO when the output has been closed after an abort. This caused sessions to remain indefinitely active when they were aborted by the client during a TCP content analysis. The proper action is to switch the stream interface to the CLO state from INI when we have write enable and shutdown write. --- src/session.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/session.c b/src/session.c index b3c50ca346..4d911a4385 100644 --- a/src/session.c +++ b/src/session.c @@ -817,10 +817,15 @@ resync_stream_interface: if (unlikely((s->req->flags & (BF_SHUTR|BF_SHUTR_NOW)) == BF_SHUTR_NOW)) s->req->prod->shutr(s->req->prod); - /* it's possible that an upper layer has requested a connection setup */ + /* it's possible that an upper layer has requested a connection setup or abort */ if (s->req->cons->state == SI_ST_INI && - (s->req->flags & (BF_WRITE_ENA|BF_SHUTW|BF_SHUTW_NOW)) == BF_WRITE_ENA) - s->req->cons->state = SI_ST_REQ; + (s->req->flags & (BF_WRITE_ENA|BF_SHUTW|BF_SHUTW_NOW))) { + if ((s->req->flags & (BF_WRITE_ENA|BF_SHUTW|BF_SHUTW_NOW)) == BF_WRITE_ENA) + s->req->cons->state = SI_ST_REQ; /* new connection requested */ + else + s->req->cons->state = SI_ST_CLO; /* shutw+ini = abort */ + } + /* we may have a pending connection request, or a connection waiting * for completion. -- 2.47.2