From c9b654b48b805dcdac34ed7f1fdafa03d617e36d Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Tue, 8 May 2007 14:46:53 +0200 Subject: [PATCH] [BUG] fix early server close after client close 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 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/proto_http.c b/src/proto_http.c index 7679970810..4540fd4d84 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -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) -- 2.47.3