Forum Discussion

smp_86112's avatar
smp_86112
Icon for Cirrostratus rankCirrostratus
Sep 08, 2011

Unsanitized URI breaks TCL

I have an iRule which relies on a switch statement:


when HTTP_REQUEST {
  switch -glob [HTTP::uri] {
    (do stuff)
  }
}

It appears that some requests result in the error in /var/log/ltm:

TCL error: secure_servlet - bad option "-♦░:┐¡π┼~┐R╟à₧}Üåî♫┬": must be -exact, -glob, -regexp, or -- while executing "switch -glob [HTTP::uri] {"

The URI string is different each time, but always some unprintable characters. I'm wondering

1) If the request caused the rule to abort

2) If so, is there way to sanitize the URI before executing the switch statement

3) Is there a better way to check the URI?

  • You can avoid that TCL error by using two hyphens to terminate the switch flag:

     

     

    switch -glob -- [HTTP::uri] {

     

     

    That will avoid the TCL runtime error and TCP reset. The request still looks like garbage though so don't expect it to match a non-default switch case.

     

     

    Aaron