From: Willy Tarreau Date: Tue, 8 May 2007 12:46:53 +0000 (+0200) Subject: [BUG] fix early server close after client close X-Git-Tag: v1.3.10~14 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c9b654b48b805dcdac34ed7f1fdafa03d617e36d;p=thirdparty%2Fhaproxy.git [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. --- 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)