Forum Discussion
hooleylist
Jan 31, 2011Cirrostratus
Here is an untested example:
when CLIENT_ACCEPTED {
log local0.debug "Collecting the payload"
TCP::collect
}
when CLIENT_DATA {
Do some parsing of [TCP::payload] here to get the user ID
In this example, we look for userid=, skip past that and read up to the next & or end of string
set user [findstr [TCP::payload] userid= 7 &]
log local0. "Parsed User ID: $user"
If a user wasn't parsed, or there is an error assigning
a pool using the format my__pool, select a default pool.
If there is a $user parsed and no error assigning it with the catch statement,
that pool will be assigned by using catch.
if {$user eq "" or [catch {pool my_${user}_pool}]}{
log local0. "\$user is null or my_\$user_pool doesn't exist. Using a default pool."
pool my_default_pool
}
}
Aaron