list element in quotes followed by <something> instead of space
The following iRule occasionally produces errors:
foreach cookie [HTTP::cookie names] {
switch -glob -- $cookie {
"xxxxx" -
"xxxx" -
"xxxx" -
"xyxyxyx" -
"xxyxyx" -
"xyxyxy*" {
HTTP::cookie remove $cookie
}
}
}
}
I was scrolling through logs and noticed this: - list element in quotes followed by "de25df2-103438293-"" instead of space while executing "foreach cookie [HTTP::cookie names] { switch -glob -- $cookie { "xxxxx" - "xxxx" - "xxx" - "xxxx" - "xxx" - "xxxxxxx" { ..."
Initially I tried to use the catch command to prevent execution failures. Mostly I wanted to see the cookie name. I wasn't able to figure out where to place it, however, as the error seems to fire on the line that initiates the switch.
I was able to prevent this error form occurring by doing the following, but it seems less efficient.
when HTTP_REQUEST {
set cookies [HTTP::cookie names]
set cookie_list [split $cookies " "]
foreach cookie $cookie_list {
switch -glob -- $cookie {
"xxxx" -
"xxxxx" -
"xxxxx" -
"xxxx" -
"xxxx*" -
"xxxxxx*" {
HTTP::cookie remove $cookie
}
}
}
}
I would like to understand how to catch the error, or figure out why the native [HTTP::cookie names] list doesn't parse well unless I split it out specifying the " " character.