]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[BUG] fix early server close after client close
authorWilly Tarreau <w@1wt.eu>
Tue, 8 May 2007 12:46:53 +0000 (14:46 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 8 May 2007 12:46:53 +0000 (14:46 +0200)
Problem reported by Andy Smith. If a client sends TCP data
and quickly closes the connection before the server connection
is established, AND the whole buffer can be sent at once when
the connection establishes, then the server side believes that
it can simply abort the connection because the buffer is empty,
without checking that some work was performed.

Fix: ensure that nothing was written before closing.

src/proto_http.c

index 7679970810b766ee4da8b8267b888daae1114bc3..4540fd4d84d7dec10687d0a34333856f424da589 100644 (file)
@@ -2318,7 +2318,8 @@ int process_srv(struct session *t)
        else if (s == SV_STCONN) { /* connection in progress */
                if (c == CL_STCLOSE || c == CL_STSHUTW ||
                    (c == CL_STSHUTR &&
-                    (t->req->l == 0 || t->be->options & PR_O_ABRT_CLOSE))) { /* give up */
+                    ((t->req->l == 0 && !(req->flags & BF_WRITE_STATUS)) ||
+                     t->be->options & PR_O_ABRT_CLOSE))) { /* give up */
                        tv_eternity(&req->cex);
                        fd_delete(t->srv_fd);
                        if (t->srv)