Forum Discussion
Nicholas_Zurfl1
Nimbostratus
Nov 03, 2005How to ignore case
Greetings,
I am a frequent lurker of the devcentral forums.
Does anyone know of a way to parse a payload and ignore case? My challange is that I am dealing with a proprietary protocol and the developers could care less if their commands are "update" "Update" "UPDATE" "uPdAtE" etc...
Collect the TCP data from the session
when CLIENT_ACCEPTED {
log local0. "TCP client accepted..."
}
when CLIENT_DATA
Parse the payload for UPDATE
if { [TCP:payload] contains "UPDATE" <--- make this case insensitive
} {
log local0. "found UPDATE"
}
TCP::release
TCP::collect
TCP::notify response
log local0. "notify response"
}
- JRahm
Admin
use: - There are several options you can go with here. If your payload isn't too large, then you could go with the above solution of using the string tolower command
if { [string tolower [TCP::payload]] contains "update" } { ... }
if { [regexp {[Uu][Pp][Dd][Aa][Tt][Ee]} [TCP::payload]] == 1 } { ... }
set content [string tolower [TCP::payload]] if { $content contains "update" } { ... } elseif { $content contains "command2" } { ... }
- unRuleY_95363Historic F5 AccountUgh, try not to use regular expressions. They are a performance monster.
if { [string first -nocase "foo" [HTTP::uri]] } {...}
- Thanks unRuleY, I didn't know about that one...
- unRuleY_95363Historic F5 AccountWell, the -nocase option is standard, just not for "string first" for some reason.
- Nicholas_Zurfl1
Nimbostratus
Joe, thanks for the warm welcome. I didn't realize that I was famous. Unfortunately, my blog has been neglected. We are in the process of creating a new site that will feature my blog among other things and will have fresh, relevent (F5), content. - I can't wait to see your new site. Let us know when it goes live and I'll promote it from here! Also, any feedback you give will help others who are facing the same issues you are.
- Lee_Orrick_5554Historic F5 AccountJust for clarity.
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