Adam_24063
Apr 15, 2007Nimbostratus
the scope of a variable.
Hello all.
I have some questions I couldn't find answers to in the docs or the archives.
What is the scope of non-global variables declared in an iRule?
Specifically, in examples i've seen situations where a variable is set in one event handler and then read in another within the same rule which leads me to believe there's a per connection context that is implicitly available.
For example, in the HTTPSession limit example, there is something like this:
when HTTP_REQUEST {
set need_cookie 0
}
when HTTP_RESPONSE {
if {$need_cookie == 1} { ... }
}
My most specific question, would this variable still be available in the CLIENT_CLOSE handler?
As a corollary, does this mean that if i have some HTML, (say for error pages) that i store in a variable that's defined in RULE_INIT that there's a copy of this hanging around for every connection ?
Now that I've laid it out in this posting I'm starting to think that the answer to all these questions is "yes", but any clarification (or pointers to docs) would be appreciated.
Thanks,
Radu