]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[MINOR] option httpclose is now checked both in FE and BE
authorWilly Tarreau <w@1wt.eu>
Sat, 30 Dec 2006 22:43:54 +0000 (23:43 +0100)
committerWilly Tarreau <w@1wt.eu>
Sat, 30 Dec 2006 22:43:54 +0000 (23:43 +0100)
The "httpclose" option affects both frontend and backend, so it
was logical to check for its presence at both places. A request
which traverses either a frontend or a backend with this option
set will have a "Connection: close" header appended.

src/proto_http.c

index 5c26f044ae90361d9bf4da2c7a3cb3764977f433..1e24f01e1ac9064134dca0467ae4c745ddc1f053 100644 (file)
@@ -585,8 +585,9 @@ int process_cli(struct session *t)
 
 
                                /* 3: We might need to remove "connection:" */
-                               if (!delete_header && (t->fe->options & PR_O_HTTP_CLOSE)
-                                   && (strncasecmp(sol, "Connection:", 11) == 0)) {
+                               if (!delete_header &&
+                                   ((t->fe->options | t->be->beprm->options) & PR_O_HTTP_CLOSE) &&
+                                   (strncasecmp(sol, "Connection:", 11) == 0)) {
                                        delete_header = 1;
                                }
 
@@ -1175,7 +1176,7 @@ int process_cli(struct session *t)
                 * FIXME: this should depend on both the frontend and the backend.
                 * Header removals should be performed when the filters are run.
                 */
-               if (t->fe->options & PR_O_HTTP_CLOSE) {
+               if ((t->fe->options | t->be->beprm->options) & PR_O_HTTP_CLOSE) {
                        int len;
                        len = buffer_replace2(req, req->data + t->hreq.eoh,
                                              req->data + t->hreq.eoh, "Connection: close\r\n", 19);
@@ -1902,7 +1903,7 @@ int process_srv(struct session *t)
                                }
 
                                /* add a "connection: close" line if needed */
-                               if (t->fe->options & PR_O_HTTP_CLOSE)
+                               if ((t->fe->options | t->be->beprm->options) & PR_O_HTTP_CLOSE)
                                        buffer_replace2(rep, rep->h, rep->h, "Connection: close\r\n", 19);
 
                                t->srv_state = SV_STDATA;
@@ -2021,8 +2022,9 @@ int process_srv(struct session *t)
                                debug_hdr("srvhdr", t, rep->h, ptr);
 
                        /* remove "connection: " if needed */
-                       if (!delete_header && (t->fe->options & PR_O_HTTP_CLOSE)
-                           && (strncasecmp(rep->h, "Connection: ", 12) == 0)) {
+                       if (!delete_header &&
+                           ((t->fe->options | t->be->beprm->options) & PR_O_HTTP_CLOSE) &&
+                           (strncasecmp(rep->h, "Connection: ", 12) == 0)) {
                                delete_header = 1;
                        }