Forum Discussion
jeff_mccombs_47
Nimbostratus
Jun 10, 2009HTTP::cookie exists v.s. [string length[HTTP::cookie NAME]] ?
So I'm playing around with universal persistence, as we have a new project getting ready to roll out that is pretty heavy with ajax/dwr. I was thinking on using the universal persistence mode against ...
jeff_mccombs_47
Nimbostratus
Jun 13, 2009Yeah, 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...
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects