Forum Discussion
Daisuke_Kishimo
Nimbostratus
Mar 12, 2007I want to evaluate character string of Cookie by a hex digit.
Hello all.
I'm Japanese.I am weak in English.
But I do my best.
I want to evaluate character string of Cookie by a hex digit.
This cookie is "EX=......" by random of hex string.
A character is "0" to "f"
I wrote following iRule.
when HTTP_REQUEST {
if { [HTTP::header exist "cookie"] }{
switch [findstr [HTTP::cookie "cookie"] "EX" 3 1] {
"0" {
use pool A_pool
}
"1" {
use pool B_pool
}
"2" {
use pool C_pool
}
.
.
.
"f" {
use pool Q_pool
}
}
}
}
This Rule is a description to check 1 character.
But,I would like to check 2 character.
The case of "00" to "0f",use pool A_pool.
The case of "10" to "1f",use pool B_pool.
The case of "20" to "2f",use pool C_pool.
.
.
.
The case of "f0" to "ff",use poll Q_pool.
In this case, It is very troublesome that I write each.
Therefore I want to make the value that I acquired a number.
Can you achieve this problem?
Thanx and regards.
- What you need there is the 'scan' command, http://tmml.sourceforge.net/doc/tcl/scan.html , and I believe you'd want something like this:
when HTTP_REQUEST { if { [HTTP::header exist "cookie"] }{ scan [HTTP::cookie "cookie"] "EX%2x" cookieval if { $cookieval <= 15 } { use pool_1 } elseif { $cookieval > 15 ....
- Daisuke_Kishimo
Nimbostratus
Aaron-san - Daisuke_Kishimo
Nimbostratus
Thank you. - JRahm
Admin
If all 00 - 0f is going to the same pool, why do you need to evaluate the second character?
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