stucky101_88485
Aug 08, 2012Nimbostratus
cannot add \r\n to string
iApp gurus
I'm working on customizing the basic http iapp to send a user agent in the http header. It looks like the
f5.app_utils:create_monitor proc doesn't let me pass such an option so I'm trying to pass the entire thing inside $monitor_send and set $monitor_dns_name and $http_version to an empty string. I'm running into 2 issues with that.
1. I removed the http_version and dns_name section and set them to empty. When I paste the following http header
GET / HTTP/1.1\r\nHost: localhost\r\nUser-Agent: F5LTM/11\r\nConnection: Close\r\n\r\n
it creates the app just fine. However the resulting http monitor is actually truncated like this :GET / HTTP/1.1\r\nHost: localhost\r\nUser-Agent: F5LTM/11\r\nConnection: Close\r\n
in other words it appears to chomp the last 2 \r\n so the pool is marked down.
2. I'd like to have this string as a default rather than GET / but it appears the string element does not accept the \r\n.
string monitor_send default "GET / HTTP/1.1\r\nHost: localhost\r\nUser-Agent: F5LTM/11\r\nConnection: Close\r\n\r\n" required display "xlarge"
causes
01070734:3: Configuration error:
/Common/f5.http_clientssl: line 117,61: error 4: Unexpected character at 'r'
/Common/f5.http_clientssl: line 117,68: Invalid character (:)
/Common/f5.http_clientssl: line 117,79: Invalid character (\)
/Common/f5.http_clientssl: line 117,81: Invalid character (\)
/Common/f5.http_clientssl: line 117,87: Invalid character (-)
/Common/f5.http_clientssl: line 117,93: Invalid character (:)
/Common/f5.http_clientssl: line 117,100: Invalid character (/)
/Common/f5.http_clientssl: line 117,101: Invalid character (1)
/Common/f5.http_clientssl: line 117,102: Invalid character (1)
/Common/f5.http_clientssl: line 117,103: Invalid character (\)
/Common/f5.http_clientssl: line 117,105: Invalid character (\)
/Common/f5.http_clientssl: line 117,117: Invalid character (:)
/Common/f5.http_clientssl: line 117,124: Invalid character (\)
/Common/f5.http_clientssl: line 117,126: Invalid character (\)
/Common/f5.http_clientssl: line 117,128: Invalid character (\)
I tried single quoting but it causes an error :
string monitor_send default 'GET / HTTP/1.1\r\nHost: localhost\r\nUser-Agent: F5LTM/11\r\nConnection: Close\r\n\r\n' required display "xlarge"
01070734:3: Configuration error:
/Common/f5.http_clientssl: line 117,45: Invalid character (')
/Common/f5.http_clientssl: line 117,50: Invalid character (/)
/Common/f5.http_clientssl: line 117,56: Invalid character (/)
/Common/f5.http_clientssl: line 117,57: Invalid character (1)
/Common/f5.http_clientssl: line 117,59: Invalid character (1)
/Common/f5.http_clientssl: line 117,60: Invalid character (\)
/Common/f5.http_clientssl: line 117,62: Invalid character (\)
/Common/f5.http_clientssl: line 117,68: Invalid character (:)
/Common/f5.http_clientssl: line 117,79: Invalid character (\)
/Common/f5.http_clientssl: line 117,81: Invalid character (\)
/Common/f5.http_clientssl: line 117,87: Invalid character (-)
/Common/f5.http_clientssl: line 117,93: Invalid character (:)
/Common/f5.http_clientssl: line 117,100: Invalid character (/)
/Common/f5.http_clientssl: line 117,101: Invalid character (1)
/Common/f5.http_clientssl: line 117,102: Invalid character (1)
I CAN quote the \ and it does let me save it this way :
string monitor_send default "GET / HTTP/1.1\\r\\nHost: localhost\\r\\nUser-Agent: F5LTM/11\\r\\nConnection: Close\\r\\n\\r\\n" required display "xlarge"
However, now the presentation layer shows this string with \\ included although it does remove them when it actually creates the monitor but it truncates the last 2 chars again.
I suppose I'm hitting a string lenght limitation ? Then again I can manually create this http header in the gui just fine.
Any insight would be appreciated.
btw if anyone cares how I'm doing this I just removed the dns_name and http_version sections from the presentation and changed the implementation a bit since I seem to be forced to pass these 2 options empty or not.
set monitor_recv \"$::server_pools__monitor_recv\"
set monitor_send \"$::server_pools__monitor_send\"
set http_version $::EMPTY_STRING
set monitor_dns_name $::EMPTY_STRING
set monitor_type http