Hi again,

Le 30/03/2012 13:24, Cyril Bonté a écrit :
Hi all,

Le 30/03/2012 12:27, William Lewis a écrit :
Baptiste wrote:
 >> (...)
You hould enable http-server-close on the frontend side as well.
Or better, put it in the defaults.

cheers


I've added http-server-close to the defaults and the acl still doesn't
match when I write the X-Original-Request header.

Actually, there's a comment in the code which talks about this issue :
/* FIXME: if the user adds a newline in the replacement, the
* index will not be recalculated for now, and the new line
* will not be counted as a new header.
*/

As a side effect, headers indexes do not point to the right position.
This means that acls do not match anymore, which is what you observe.

It appears several times in the code, the one that concerns this issue
in the function apply_filter_to_req_line() in src/proto_http.c

Please find in attachment a quick and *dirty* fix to realign the headers indexes for your case (based on haproxy 1.4.20).
Maybe this can help you.

--
Cyril Bonté
--- ./haproxy-1.4.20/src/proto_http.c	2012-03-10 21:06:21.000000000 +0100
+++ ./haproxy-1.4.20-newline/src/proto_http.c	2012-03-30 15:14:31.127457646 +0200
@@ -5849,12 +5849,20 @@
 
 			http_msg_move_end(&txn->req, delta);
 			cur_end += delta;
-			cur_end = (char *)http_parse_reqline(&txn->req, req->data,
-							     HTTP_MSG_RQMETH,
-							     cur_ptr, cur_end + 1,
-							     NULL, NULL);
-			if (unlikely(!cur_end))
-				return -1;
+			/* Quick and dirty hack to realign headers indexes if the user adds a newline
+			 * in the replacement.
+			 */
+			{
+				char *cur_end2 = (char *)http_parse_reqline(&txn->req, req->data,
+									     HTTP_MSG_RQMETH,
+									     cur_ptr, cur_end + 1,
+									     NULL, NULL);
+				if (unlikely(!cur_end2))
+					return -1;
+				if (cur_end - cur_end2 > 0) {
+					txn->req.sl.rq.l += cur_end - cur_end2;
+				}
+			}
 
 			/* we have a full request and we know that we have either a CR
 			 * or an LF at <ptr>.

Reply via email to