From: Willy Tarreau Date: Sun, 18 Oct 2009 21:52:50 +0000 (+0200) Subject: [MINOR] http response: update the TX_CLI_CONN_KA flag on rewrite X-Git-Tag: v1.4-dev5~89 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b50943e717de78d88756d1ea8bc0cbd5c2e59677;p=thirdparty%2Fhaproxy.git [MINOR] http response: update the TX_CLI_CONN_KA flag on rewrite If we modify the "connection" header we send to the client, update the TX_CLI_CONN_KA flag. --- diff --git a/src/proto_http.c b/src/proto_http.c index a98f2a52bb..f98ff5ad28 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -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)