issue with newline

hi all,

i’ve a strange issue with an irule:

i can’t add new line in a variable.

i try with:

set allHeaders [concat $allHeadersTemp ‘\n’]

set allHeaders [concat $allHeadersTemp “\n”]

set allHeaders [concat $allHeadersTemp \n]

set allHeaders [concat $allHeadersTemp ‘\r\n\r\n’]

set allHeaders [concat $allHeadersTemp ‘\r\n’]

set allHeaders [concat $allHeadersTemp “\r\n”]

set allHeaders [concat $allHeadersTemp “\r\n\r\n”]

set allHeaders [append allHeadersTemp “\r\n\r\n”]

and so on…

but when i log the variable with

log local0.debug " $allHeader"

the results is alway a single line with blank space instead new line.

can u help me?

thanks in advice :slight_smile:

Newlines won’t print in the log messages and the function you’re looking for is called “join.” I think the combination is what may be causing your issue here. Try printing them in an HTTP response like this and see how it works:

ltm rule concat_http_headers {when HTTP_REQUEST {  set header_names [HTTP::header names]  foreach header $header_names {    lappend headers "$header: [HTTP::header value $header]"  }   HTTP::respond 200 content [join $headers "\n"]}}

Hope this helps,

George

hi,

thanks for replay.

this variable is fill to send througth connect command to backend server, and the tcpdump on server side shows that newline doesn’t arrive well formatted.

after a lot of test i think the problem is concat command and i’ve resolved using append in this way:

set invia [concat "GET " $myUri ]

append invia " HTTP/1.0\r\n\r\n"

thanks.