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 JSESSIONID.
And lo, the wonder community has provided me with a template (see: http://devcentral.f5.com/wiki/default.aspx/iRules/Weblogic_JSessionID_Persistence.html), and it should get me going at least, right?
But I'm curious.. I noticed in my testing that [HTTP::cookie exists JSESSIONID] and [string length[HTTP::cookie JSESSIONID]] don't jive with eachother.
Here's what I mean:
set ex [HTTP::cookie exists JSESSIONID]
set le [string length[HTTP::cookie JSESSIONID]]
Now when I test this little snippet of code, I find the following:
1. IF a JSESSIONID cookie was set: ex==1 && le==1
2. IF _NO_ JSESSIONID cookie was set: ex==0 && le==1
WTF? Now how does that work? Shouldn't le==0, because JSESIONID does not exist?
- The_Bhattman
Nimbostratus
ex is more or less returning a result of a comparison, not the actual value. - jeff_mccombs_47
Nimbostratus
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. - jeff_mccombs_47
Nimbostratus
Er. Whoops. that 2nd log line should read: - The_Bhattman
Nimbostratus
It kinda seems obvious now that the variable is not updated when it's a null value. Perhaps an IF statement that resets the value when it detects that the JSESSION doesn't exist? - jeff_mccombs_47
Nimbostratus
Well, as I mentioned I have a work around. I'm essentilly checking both; - The_Bhattman
Nimbostratus
There is a setting the VIP where you can select a fallback persistence profile. - jeff_mccombs_47
Nimbostratus
Right. You can set source_addr as the fallback. What I meant though, was that I would see universal persistece entries with no key. Again, not a big deal as I worked around it. It's just odd is all. - hoolio
Cirrostratus
Hi jsmccombs,log local0. "path: [HTTP::path]" log local0. "\[HTTP::header value Cookie\]: [HTTP::header value Cookie]" log local0. "\[HTTP::cookie exists JSESSIONID\]: [HTTP::cookie exists JSESSIONID]" log local0. "\[string length \[HTTP::cookie JSESSIONID\]\]: [string length [HTTP::cookie JSESSIONID]]" }
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