]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[MINOR] http response: update the TX_CLI_CONN_KA flag on rewrite
authorWilly Tarreau <w@1wt.eu>
Sun, 18 Oct 2009 21:52:50 +0000 (23:52 +0200)
committerWilly Tarreau <w@1wt.eu>
Sun, 18 Oct 2009 21:53:19 +0000 (23:53 +0200)
If we modify the "connection" header we send to the client,
update the TX_CLI_CONN_KA flag.

src/proto_http.c

index a98f2a52bbbe0e463cbe578aec00e21a77266583..f98ff5ad2804a8b37a08b3ecc8c73892d59e1972 100644 (file)
@@ -3323,6 +3323,15 @@ int http_process_res_common(struct session *t, struct buffer *rep, int an_bit, s
                                }
                        }
 
+                       /* if there is no "Connection: keep-alive" header left and we're
+                        * in HTTP/1.0, then non-persistent connection is implied */
+                       if (!(t->flags & SN_CONN_CLOSED) && (msg->sl.st.v_l == 8) &&
+                           (rep->data[msg->som + 5] == '1') &&
+                           (rep->data[msg->som + 7] == '0')) {
+                               t->flags |= SN_CONN_CLOSED;
+                               txn->flags &= ~TX_CLI_CONN_KA; /* keep-alive closed on server side */
+                       }
+
                        /* add response headers from the rule sets in the same order */
                        for (cur_idx = 0; cur_idx < rule_set->nb_rspadd; cur_idx++) {
                                if (txn->status < 200)