Forum Discussion
darragh_19954
Nimbostratus
Nov 14, 2007Can global variables be used to carry information between events?
I'd like to use a global variable set up in the RULE_INIT event to carry some client-specific conditional information between the HTTP_REQUEST and HTTP_RESPONSE events. Is this possibe>
Here is the pseudo-code:
when RULE_INIT {
set ::variable 0
}
when HTTP_REQUEST {
conditional
if { ... } {
set ::variable 1
} elseif { ... } {
set ::variable 2
} ...
}
when HTTP_RESPONSE {
switch $::variable {
1 { ... }
2 { ... }
3 { ... }
default { ... }
}
}
So if 2 clients make a request at the same time, and they each have different settings for this variable, will those client-specific settings be preserved when the HTTP_RESPONSE event is called for each?
- Brian_69413
Nimbostratus
Yes, I believe it is preserved for each session. - hoolio
Cirrostratus
Global variables are accessible across all TCP connections and all events. Local variables are accessible across all events of a single TCP connection.
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