Forum Discussion
gprabhu_133561
Nimbostratus
Feb 12, 2014Need help with proc irule
Hi,
I'm new to iRule, but have decent scripting skills with Perl. As explained in the below link, i tried the first example. When i try to save my iRule, I get the below exception. Note: My BigI...
Kevin_Stewart
Employee
Feb 12, 2014Jason is showing you what the iRule looks like in the config file. The "rule encodeHTML }" at the top, and the final closing curly brace are part of the rule definition. So to simulate what he's done, create a new rule called "encodeHTML" and start the proc with the "proc" command:
proc html_encode { str } {
set encoded ""
foreach char [split $str ""] {
switch $char {
"<" { append encoded "<" }
">" { append encoded ">" }
"'" { append encoded "'" }
{"} { append encoded """ }
"&" { append encoded "&" }
default { append encoded $char }
}
}
return $encoded
}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects