I am just starting to learn iRules and I am examining the CodeShare examples to learn from best practices.
Looking at the Phising Prevention iRule, I think that some optimization is possible. The iRule can be evated using capital characters in filename extensions
This is the code in line 32:
if { ([string tolower [HTTP::method] ] eq "get") && ([matchclass [HTTP::uri] contains $::file_types] > 0 )} {
I would suggest the line below is better.
if { ([string tolower [HTTP::method] ] eq "get") && ([matchclass [string tolower[HTTP::uri]] contains $::file_types] > 0 )} {
The only uncertainty is that I assumed that matchclass is case sensitive.
Im I right on this or did I miss something?
For reference: the class file_types that is referred to is defined as below:
class file_types {
“.gif”
“.jpg”
“.png”
“.bmp”
“.js”
“.css”
“.xsl”
}