Forum Discussion
Sep 27, 2006
surrounding the HTTP::uri with a "string tolower" command should do the trick. But, you'll probably want to do it for each conditional statement. An alternative, and more optimal, approach would be to use a switch statement like this:
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::uri]] {
"*cgi" {
pool cgi_pool
}
"/abc*" {
pool abc_servers
}
}
}
The -glob option uses wildcards and is not as expensive as a regular expression check. Your alternative would have been something like this:
when HTTP_REQUEST {
if { [string tolower [HTTP::uri]] ends_with "cgi" } {
pool cgi_pool
} elseif { [string tolower [HTTP::uri]] starts_with "/abc" } {
pool abc_servers
}
}
But, this does two string conversions to lower case. You could also store the lowercase uri in a variable
when HTTP_REQUEST {
set uri [string tolower [HTTP::uri]]
if { $uri ends_with "cgi" } {
pool cgi_pool
} elseif { $uri starts_with "/abc" } {
pool abc_servers
}
}
Lots of options...
-Joe