]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[MINOR] http redirect: don't explicitly state keep-alive on 1.1
authorWilly Tarreau <w@1wt.eu>
Sun, 10 Jan 2010 09:35:01 +0000 (10:35 +0100)
committerWilly Tarreau <w@1wt.eu>
Sun, 10 Jan 2010 09:35:01 +0000 (10:35 +0100)
Do not set the "connection: keep-alive" header when the request is in
HTTP 1.1, it's implicit.

src/proto_http.c

index f2f312e3b756bfa82d21e82d62740536cced51e7..92c58691a821a1da1b9604e2890eee42925ab912 100644 (file)
@@ -2867,8 +2867,12 @@ int http_process_req_common(struct session *s, struct buffer *req, int an_bit, s
                            ((txn->flags & TX_CON_WANT_MSK) == TX_CON_WANT_SCL ||
                             (txn->flags & TX_CON_WANT_MSK) == TX_CON_WANT_KAL)) {
                                /* keep-alive possible */
-                               memcpy(rdr.str + rdr.len, "\r\nConnection: keep-alive\r\n\r\n", 28);
-                               rdr.len += 28;
+                               if (!(txn->flags & TX_REQ_VER_11)) {
+                                       memcpy(rdr.str + rdr.len, "\r\nConnection: keep-alive", 24);
+                                       rdr.len += 24;
+                               }
+                               memcpy(rdr.str + rdr.len, "\r\n\r\n", 4);
+                               rdr.len += 4;
                                buffer_write(req->prod->ob, rdr.str, rdr.len);
                                /* "eat" the request */
                                buffer_ignore(req, msg->sov - msg->som);