]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[MINOR] http: pre-set the persistent flags in the transaction
authorWilly Tarreau <w@1wt.eu>
Sun, 18 Oct 2009 21:43:57 +0000 (23:43 +0200)
committerWilly Tarreau <w@1wt.eu>
Sun, 18 Oct 2009 21:43:57 +0000 (23:43 +0200)
We should pre-set the persistent flags then try to clear them
instead of the opposite.

src/proto_http.c

index 31a2098f6768ced06f01a5b7e5df121b2ffeefb8..207483ce1f28ca3471c0609513e7148b8df06fde 100644 (file)
@@ -2069,16 +2069,20 @@ int http_wait_for_request(struct session *s, struct buffer *req, int an_bit)
                        conn_ka = 1;
        }
 
+       /* prepare flags for this transaction */
+       txn->flags |= (TX_CLI_CONN_KA | TX_SRV_CONN_KA);
+       txn->flags |= (TX_CLI_CONN_KA | TX_SRV_CONN_KA);
+
        if ((msg->sl.rq.v_l == 8) &&
            (req->data[msg->som + msg->sl.rq.v + 5] == '1') &&
            (req->data[msg->som + msg->sl.rq.v + 7] == '0')) {
                /* HTTP/1.0 */
-               if (conn_ka)
-                       txn->flags |= (TX_CLI_CONN_KA | TX_SRV_CONN_KA);
+               if (!conn_ka)
+                       txn->flags &= ~(TX_CLI_CONN_KA | TX_SRV_CONN_KA);
        } else {
-               /* HTTP/1.0 */
-               if (!conn_cl)
-                       txn->flags |= (TX_CLI_CONN_KA | TX_SRV_CONN_KA);
+               /* HTTP/1.1 */
+               if (conn_cl)
+                       txn->flags &= ~(TX_CLI_CONN_KA | TX_SRV_CONN_KA);
        }
 
        /* we can mark the connection as non-persistent if needed */