Forum Discussion

uni's avatar
uni
Icon for Altostratus rankAltostratus
Nov 21, 2006

switch -nocase option not working

I can't get the -nocase option working in the switch statement. Am I doing something wrong, or isn't this supported? I'm using version 9.1.1.


[root@lsnetg-edu7:Active] sgun  b merge -
rule test-rule {
   timing on
   when HTTP_REQUEST {
      switch -nocase [HTTP::uri] {
         "/aaa"   { HTTP::respond 200 content "[HTTP::uri] : aaa\n" }
         default { HTTP::respond 200 content "[HTTP::uri] : default\n" }
      }
   }
}
BIGpipe: rule modification error:
    01070151:3: Rule [test-rule] error:
line 3: [invalid switch: "-nocase"] [-nocase]

2 Replies

  • Alternately you could use it directly in the switch as well.

    switch [string tolower [HTTP::uri]] {
     ...

    -Joe
  • uni's avatar
    uni
    Icon for Altostratus rankAltostratus
    Thanks people. In fact, I had been doing just what Joe suggests, but then noticed the -nocase switch in the doco.

     

     

    Curiously, even though the F5 version of TCL doesn't support the option, unRuleY uses it as an example in another post Click here