Forum Discussion
jeff_mccombs_47
Jun 13, 2009Nimbostratus
Yeah, I thought that myself.. but when JSESSIONID is null, [string length [HTTP::cookie JSESSIONID]] is still returning 1, which is what I'm having a hard time understanding.
If I fire up "tclsh", and try and run a string length against a variable with a null value, I should get 0.. right?
So here's a snippet of my logs from the test. First the code;
set ex [HTTP::cookie exists JSESSIONID]
set le [string length [HTTP::cookie JSESSIONID]
log local0. "DEBUG: ex: $ex le: $le"
log local0. "DEBUG: JSESSIONID: *******||*****"
And the output, if no JSESSIONID is set:
DEBUG: DEBUG: ex: 0 le: 1
DEBUG: JSESSIONID: *******||*****
So how is that possible? How can [string length[HTTP::cookie JSESSIONID]] return 1, when there is nothing in the cookie, and [HTTP::cookie JSESSIONID] returns false? If the "string length" command was evaluating [HTTP::cookie JSESSIONID] as a string, rather than interpreting it, I still shouldn't get 1.. I should get 25.. not 1.
I've worked around this oddity in my iRule already, so this is more of a curiosity at this point...