kai_wang_48807
Feb 04, 2007Nimbostratus
if syntax help!
1. Whether the if could be nested in iRule?
E.g if {} {
if {} {
}
elseif {} {
}
}
2. Whether the when could be nested in iRule?
E.g when xx {
when xx {
}
}
Thanks!
Kai
E.g if {} {
if {} {
}
elseif {} {
}
}
2. Whether the when could be nested in iRule?
E.g when xx {
when xx {
}
}
Thanks!
Kai
So, this IS legal:
when HTTP_REQUEST {
if { condition_1 } {
if { condition_2 } {
if { condition_3 } {
} elseif { condition_4 } {
and on and on an on...
} else {
}
} elseif { condition_5 } {
} else {
}
} elseif { condition_6 } {
} else {
}
}
But the when statement is a special F5 extension to TCL that allows for event triggering. Think of it like a function in C. These are only allowed at the outermost scope within an iRule.
This is NOT legal:
when HTTP_REQUEST {
when HTTP_RESPONSE {
}
}
But, this IS legal:
when HTTP_REQUEST {
...
}
when HTTP_RESPONSE {
...
}
-Joe