]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[BUG] switch server-side stream interface to close in case of abort
authorWilly Tarreau <w@1wt.eu>
Fri, 6 Mar 2009 11:51:23 +0000 (12:51 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 6 Mar 2009 11:51:23 +0000 (12:51 +0100)
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

index b3c50ca3464131a1fb16225ac8ef3969d8577e7c..4d911a4385856cbfa04223e3200a984a9833689e 100644 (file)
@@ -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.