NetTalk Central

Author Topic: Multiple SessionID session variables in my cookies? - part 2  (Read 4203 times)

patrick de laet

  • Newbie
  • *
  • Posts: 35
    • View Profile
    • ShopPlus
    • Email
Multiple SessionID session variables in my cookies? - part 2
« on: December 28, 2011, 12:49:29 AM »
My original thread is no longer readable??
I receive an empty page?

regards

Patrick De Laet

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: Multiple SessionID session variables in my cookies? - part 2
« Reply #1 on: December 28, 2011, 12:58:37 AM »
yes, it's something I'm working on with John. At some point Joomla got upgraded, and it seems there's some sort of limit on how many times 1 person can post in a thread - I suppose to prevent endless flame wars etc. So far we haven't found the setting though to lift it. You can still read the thread if you access it via a different browser (ie so you're not logged in).

In my most recent post, I asked that you post, or email, me your modified example 1.

cheers
Bruce

patrick de laet

  • Newbie
  • *
  • Posts: 35
    • View Profile
    • ShopPlus
    • Email
Re: Multiple SessionID session variables in my cookies? - part 2
« Reply #2 on: December 28, 2011, 12:59:21 AM »
Bruce,

I've prepared a zip file for you: www.shopplus.be/$bruce.zip

It contains:
1. the example web1.app - i didn't change anything in it - I just use it to display my static page http://localhost:88/nl/vragen2.html
2. a 'web' folder containing my static HTML page and some subfolders for the css, js, assets, ...
3. some screenshots showing the duplicate SESSIONID cookies

To test:
1. delete all your cookies from Firefox
2. display my http://localhost:88/nl/vragen2.html page
3. view your cookies in Firefox - you will have duplicate SESSIONIDS
4. if not - hit F5 to refresh
5. view your cookies in Firefox - you will have duplicate SESSIONIDS
6. if not ==> I'm crazy  :o

regards

Patrick De Laet


« Last Edit: December 28, 2011, 01:01:57 AM by patrick de laet »

patrick de laet

  • Newbie
  • *
  • Posts: 35
    • View Profile
    • ShopPlus
    • Email
Re: Multiple SessionID session variables in my cookies? - part 2
« Reply #3 on: December 31, 2011, 02:14:15 AM »
Bruce,

SetCookie method in nethttp.clw is testing 8 parameters but there are online 7 in the prototype.
eg:isn't the p_Path the 6th parameter and not the 7th?
Maybe this is causing the creation of x cookies - one  cookie for every path combination (see my previous thread)

  If not omitted(7)!(p_Path)
    self._CookieQueue.Path = p_path
  end

I have NetTalk 5.45 - as indicated in the templates - but in nethttp.clw I see 5.44?

! NetTalk v5.44 - the premier TCP/IP solution. Copyright © 2000-2011 CapeSoft Software - www.capesoft.com
NetWebHttp.SetCookie  PROCEDURE (String p_name,String p_Value,<Long p_Date>,<Long p_Time>,<Long p_Secure>,<String p_Path>,<String p_Domain>)
  Code
  If p_name = '' then return.
  clear(self._CookieQueue)
  self._CookieQueue.Name = Upper(p_name)
  get(self._CookieQueue,self._CookieQueue.Name)
  if Errorcode()
    Add(self._CookieQueue)
  End
  self._CookieQueue.Value = p_Value
  If not omitted(4)!(p_Date)
    self._CookieQueue.ExpiresDate = p_date
  end
  If not omitted(5)!(p_Time)
    self._CookieQueue.ExpiresTime = p_time
  end
  If not omitted(6)!(p_Secure)
    self._CookieQueue.Secure = p_secure
  end
  If not omitted(7)!(p_Path)
    self._CookieQueue.Path = p_path
  end
 
If not omitted( 8 )!(p_Domain)
    self._CookieQueue.Domain = p_domain
  end
  put(self._CookieQueue)

regards

Patrick De Laet

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: Multiple SessionID session variables in my cookies? - part 2
« Reply #4 on: January 01, 2012, 11:58:38 PM »
>> SetCookie method in nethttp.clw is testing 8 parameters but there are online 7 in the prototype.
>> eg:isn't the p_Path the 6th parameter and not the 7th?

When dealing with objects the parameter list count starts at 2, not 1. ie p_name is the _second_ parameter. This is because all methods take their object instance (self) as the implicit first parameter.

aside: In Clarion 6 and later it's preferable to use the parameter name instead of the parameter number in an OMITTED statement. Thus the best way to write this code is
If not omitted(p_Path)
Unfortunately C5.5 (which we still support) does not support this syntax - and worse compiles it as
If not omitted(some-number-in-pPath-which-is-usually-zero)

Cheers
Bruce

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: Multiple SessionID session variables in my cookies? - part 2
« Reply #5 on: January 02, 2012, 12:02:59 AM »
The root of the problem seems to be that the "path" for a cookie defaults to an unexpected value. Rather than default to nothing ('\') it defaults to the path of the url it thought it was fetching.

The solution is to change the default to something explicit, like this;

  If not omitted(7)!(p_Path)
    self._CookieQueue.Path = p_path
  else
    self._CookieQueue.Path = '/'
  end

I've made this change to 6.13 - if you are using Nt4 or NT5 then you can make this change there as well. I'm hesitant to make this change in the official NT5 build at this time, because of the potential for unwanted side-effects. I may add it to NT5 in the future if it proves uneventful in NT6 though.

Cheers
Bruce

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: Multiple SessionID session variables in my cookies? - part 2
« Reply #6 on: January 02, 2012, 12:51:24 AM »
update: This change will likely be in the 5.46 build.

patrick de laet

  • Newbie
  • *
  • Posts: 35
    • View Profile
    • ShopPlus
    • Email
Re: Multiple SessionID session variables in my cookies? - part 2
« Reply #7 on: January 02, 2012, 03:57:52 AM »
Thanks Bruce,

I'll give it a try.

regards

Patrick De Laet

patrick de laet

  • Newbie
  • *
  • Posts: 35
    • View Profile
    • ShopPlus
    • Email
Re: Multiple SessionID session variables in my cookies? - part 2
« Reply #8 on: January 02, 2012, 04:25:20 AM »
Bruce,

I changed the SetCookie method as you explained and everything works now.
I can land via Google on 1 of my 10000 SEO friendly pages and my Ajax calls are working !
There is only 1 SESSIONID cookie created with path=/

have a nice day.

regards

Patrick