package: haproxy
[packages.git] / net / haproxy / patches / 0023-BUG-MINOR-http-don-t-process-abortonclose-when-1.4.22.diff
1 From d978423607b6666ca8dd3257d860558ead1b94af Mon Sep 17 00:00:00 2001
2 From: Willy Tarreau <w@1wt.eu>
3 Date: Sun, 30 Dec 2012 00:50:35 +0100
4 Subject: BUG/MINOR: http: don't process abortonclose when request was sent
5
6 option abortonclose may cause a valid connection to be aborted just
7 after the request has been sent. This is because we check for it
8 during the session establishment sequence before checking for write
9 activity. So if the abort and the connect complete at the same time,
10 the abort is still considered. Let's check for an explicity partial
11 write before aborting.
12
13 This fix should be backported to 1.4 too.
14 (cherry picked from commit a7a7ebc38280d7a04192bf95e6852222f4bd8140)
15 ---
16  src/session.c |    3 ++-
17  1 files changed, 2 insertions(+), 1 deletions(-)
18
19 diff --git a/src/session.c b/src/session.c
20 index 239d4f5..6211a45 100644
21 --- a/src/session.c
22 +++ b/src/session.c
23 @@ -203,7 +203,8 @@ int sess_update_st_con_tcp(struct session *s, struct stream_interface *si)
24         }
25  
26         /* OK, maybe we want to abort */
27 -       if (unlikely((rep->flags & BF_SHUTW) ||
28 +       if (!(req->flags & BF_WRITE_PARTIAL) &&
29 +           unlikely((rep->flags & BF_SHUTW) ||
30                      ((req->flags & BF_SHUTW_NOW) && /* FIXME: this should not prevent a connection from establishing */
31                       (((req->flags & (BF_OUT_EMPTY|BF_WRITE_ACTIVITY)) == BF_OUT_EMPTY) ||
32                        s->be->options & PR_O_ABRT_CLOSE)))) {
33 -- 
34 1.7.1
35