David_L_
Sep 10, 2007Nimbostratus
TCL IF/Else processing problem?
I'm using an iRule to manually manipulate the persistence table - adding a persistence record on login and deleting it on logout. I'm seeing a behavior I can't explain - perhaps someone here can help?
For the most part this works as expected. Persistence appears to be maintained correctly. The problem is that when I look at the log entries created by this rule I see:
... Added Added persistence for session XXXXXX (as expected on login)
... Updated persistence for session XXXXXX (repeated many times as expected)
... Deleted persistence for session (as expected on logout)
... Updated persistence for session XXXXXX (This line is the problem!)
Why is the "Else" statement apparently being executed after the "If" condition is met and statement executed? Am I missing something fundamental about this?
Thanks!
The iRule is:
-------------------------------------------------------
when CLIENT_ACCEPTED {
set add_persist 1
}
when HTTP_RESPONSE {
if { [HTTP::cookie exists "JSESSIONID"] and $add_persist } {
persist add uie [HTTP::cookie "JSESSIONID"] 1800
set add_persist 0
log local0. " Added persistence for session [HTTP::cookie "JSESSIONID"]"
}
}
when HTTP_REQUEST {
if { [HTTP::uri] contains "logout.do"} {
persist delete uie [HTTP::cookie "JSESSIONID"]
log local0. " Deleted persistence for session [HTTP::cookie "JSESSIONID"]"
} else {
persist uie [HTTP::cookie "JSESSIONID"] 1800
log local0. " Updated persistence for session [HTTP::cookie "JSESSIONID"]"
}
}
------------------------------------------------------------