Forum Discussion
Append to list stored in table key
Well, so here is my goal, probably what I posted was a bit misleading:
When http req check if given cookie exists and created entry in sub/table using as a key session id value from cookie and as value list with client IP address.
Then for each new connection check if IP in the list is the same, if not add new IP as next entry in the list.
timeout and lifetime for table key is irrelevant here - it will be set depending on situation.
So code could be:
when HTTP_REQUEST {
set s_id [HTTP::cookie value $my_cookie]
if { [table lookup $s_id] eq "" } {
table set $s_id [IP::client_addr]
} else {
set cur_v [table lookup $s_id]
if { [lsearch $cur_v [IP::client_addr]] == -1 } {
lappend cur_v [IP::client_addr]
table set $s_id $cur_v
}
}Just wonder if it can be done in more optimized way.
Piotr
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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