F5 is upgrading its customer support chat feature on My.F5.com. Chat support will be unavailable from 6am-10am PST on 1/20/26. Refer to K000159584 for details.

Forum Discussion

Sam_Hall's avatar
Sam_Hall
Icon for Nimbostratus rankNimbostratus
Dec 15, 2013

switch -glob behaviour when comparison string starts with a hyphen

I'm attempting to use this iRule... https://devcentral.f5.com/articles/stop-those-xss-cookie-bandits-irule-style

 

However, when the server sends "Set-Cookie=SOMETHING=-1" I get the error... bad option "-1": must be -exact, -glob, -regexp, or -- while executing "switch -glob "${testvalue}" { ";secure" - "; secure" { } default { set value "$value; Secure"; } }" ("foreach" body line 8) invoked from within "foreach cookie [HTTP::cookie names] { if { [HTTP::cookie path $cookie] != "/" } { set value [HTTP::cookie value $cookie]; if { "" != $..."

 

How do I tell "switch" not to interpret the sting "-1" as an option? As you can see in the error message, I've tried enclosing it in quotes.

 

I can't reproduce this behaviour using tclsh. Is this a bug?