From 0e7223f625d8db9f7f2593fa88b97129b89e4d3a Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Mon, 28 Dec 2009 18:08:19 -0500 Subject: Do not replace \n with spaces --- config/haproxy/haproxy.inc | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'config') diff --git a/config/haproxy/haproxy.inc b/config/haproxy/haproxy.inc index 7f57ae33..7102974c 100644 --- a/config/haproxy/haproxy.inc +++ b/config/haproxy/haproxy.inc @@ -109,7 +109,7 @@ function haproxy_configure() { if(is_array($a_global)) { fwrite ($fd, "global\n"); if($a_global['advanced']) - fwrite ($fd, "\t" . str_replace("\n", " ", base64deode($a_global['advanced'])) . "\n"); + fwrite ($fd, "\t" . base64deode($a_global['advanced']) . "\n"); fwrite ($fd, "\tmaxconn\t\t\t".$a_global['maxconn']."\n"); if($a_global['remotesyslog']) fwrite ($fd, "\tlog\t\t\t{$a_global['remotesyslog']}\n"); @@ -151,10 +151,12 @@ function haproxy_configure() { fwrite ($fd, "{$backendinfo}"); fwrite ($fd, "{$listenip}"); - // Advanced pass trhu - if($backend['advanced']) - fwrite ($fd, "\t" . str_replace("\n", " ", base64_decode($backend['advanced'])) . "\n"); - + // Advanced pass thru + if($backend['advanced']) { + $advanced = base64_decode($backend['advanced']); + fwrite($fd, "\t" . $advanced) . "\n"); + } + // https is an alias for tcp for clarity purpouses if(strtolower($backend['type']) == "https") { $backend_type = "tcp"; @@ -233,10 +235,12 @@ function haproxy_configure() { } else { $server_ports[] = $server['port']; } - if($server['advanced']) - $advanced_txt = " " . str_replace("\n", " ", base64_decode($server['advanced'])); - else + if($server['advanced']) { + $advanced = base64_decode($server['advanced']); + $advanced_txt = " " . $advanced; + } else { $advanced_txt = ""; + } foreach($server_ports as $pport) fwrite ($fd, "\tserver\t\t\t" . $server['name'] . " " . $server['address'].":" . $pport . " $cookie " . " check inter 1000 weight " . $server['weight'] . "{$advanced_txt}\n"); } -- cgit v1.2.3