[JIRA] (COMETD-350) Reload extension creating two cookies with different path

9 views
Skip to first unread message

Saitz Peter (Created) (JIRA)

unread,
Mar 20, 2012, 2:21:25 PM3/20/12
to comet...@googlegroups.com
Reload extension creating two cookies with different path
---------------------------------------------------------

Key: COMETD-350
URL: http://bugs.cometd.org/browse/COMETD-350
Project: CometD
Issue Type: Bug
Components: javascript-dojo
Affects Versions: 2.4.0
Reporter: Saitz Peter
Priority: Minor


I am using Reload extension, and I am manually adjusting its configuration:

var cnf = {cookieMaxAge: 15, cookiePath: configCookiePath};
cometd.reload(cnf);

The org.cometd.reload cookie is set correctly, with "path: /mypath" containing data, but I also can see another empty org.cometd.reload cookie set with "path: /"

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: http://bugs.cometd.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


Simone Bordet (Resolved) (JIRA)

unread,
Apr 11, 2012, 11:50:25 AM4/11/12
to comet...@googlegroups.com

[ http://bugs.cometd.org/browse/COMETD-350?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Simone Bordet resolved COMETD-350.
----------------------------------

Assignee: Simone Bordet
Fix Version/s: 2.4.1
Resolution: Fixed

Fixed.
The reload extension was just clearing the value, but not setting expires or max-age to -1 to actually remove the cookie.



> Reload extension creating two cookies with different path
> ---------------------------------------------------------
>
> Key: COMETD-350
> URL: http://bugs.cometd.org/browse/COMETD-350
> Project: CometD
> Issue Type: Bug
> Components: javascript-dojo
> Affects Versions: 2.4.0
> Reporter: Saitz Peter

> Assignee: Simone Bordet
> Priority: Minor
> Fix For: 2.4.1

Saitz Peter (Commented) (JIRA)

unread,
May 6, 2012, 7:45:25 PM5/6/12
to comet...@googlegroups.com

[ http://bugs.cometd.org/browse/COMETD-350?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=10874#comment-10874 ]

Saitz Peter commented on COMETD-350:
------------------------------------

cometd 2.4.2

I can still see 2 reload cookies:
1. path / (this one is empty and has no expire set, it is a session cookie)
2. path /mypath (mypath is set manually, this one has data has proper Expire set)

as follows:

OnUnLoad() {
var cnf = {cookieMaxAge: 15, cookiePath: configCookiePath};
dojox.cometd.reload(cnf);
}

Why is cookie with path / set at all? All that was defined is cookie with path /mypath
(that was actually original bug report that it seems did not get fixed, if this is a bug)

> Reload extension creating two cookies with different path
> ---------------------------------------------------------
>
> Key: COMETD-350
> URL: http://bugs.cometd.org/browse/COMETD-350
> Project: CometD
> Issue Type: Bug
> Components: javascript-dojo
> Affects Versions: 2.4.0
> Reporter: Saitz Peter
> Assignee: Simone Bordet
> Priority: Minor
> Fix For: 2.4.1
>
>

Saitz Peter (Commented) (JIRA)

unread,
May 7, 2012, 5:03:25 AM5/7/12
to comet...@googlegroups.com

[ http://bugs.cometd.org/browse/COMETD-350?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=10875#comment-10875 ]

Saitz Peter commented on COMETD-350:
------------------------------------

I figured it out:

When OnUnload the cometd.reload(myconfig) is called, cookie is properly set with myconf specific path.

But, whennew pageis loaded and cookie is found, code cleares cookie with default _configPath.

To solve this, when setting cookie, it needs to add myconfig.cookiePath asavalue inside cookie. Then when it is being read on new page load, itshould clear cookie with path set to myconfig.cookiePath.

So, in case I do set custom cokiePath, reload extension is not working properly.

> Reload extension creating two cookies with different path
> ---------------------------------------------------------
>
> Key: COMETD-350
> URL: http://bugs.cometd.org/browse/COMETD-350
> Project: CometD
> Issue Type: Bug
> Components: javascript-dojo
> Affects Versions: 2.4.0
> Reporter: Saitz Peter
> Assignee: Simone Bordet
> Priority: Minor
> Fix For: 2.4.1
>
>

Saitz Peter (Reopened) (JIRA)

unread,
May 15, 2012, 6:33:25 PM5/15/12
to comet...@googlegroups.com

[ http://bugs.cometd.org/browse/COMETD-350?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Saitz Peter reopened COMETD-350:
--------------------------------


> Reload extension creating two cookies with different path
> ---------------------------------------------------------
>
> Key: COMETD-350
> URL: http://bugs.cometd.org/browse/COMETD-350
> Project: CometD
> Issue Type: Bug
> Components: javascript-dojo
> Affects Versions: 2.4.0, 2.4.1
> Reporter: Saitz Peter
> Assignee: Simone Bordet
> Priority: Minor
> Fix For: 2.4.1
>
>

Simone Bordet (Commented) (JIRA)

unread,
May 16, 2012, 12:40:26 PM5/16/12
to comet...@googlegroups.com

[ http://bugs.cometd.org/browse/COMETD-350?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=10881#comment-10881 ]

Simone Bordet commented on COMETD-350:
--------------------------------------

You should configure the reload extension at startup, and just call cometd.reload() without parameters from unload handlers:

{code:javascript}
// At startup, before calling cometd.init()
cometd.getExtension('reload').configure({cookieMaxAge:10});

...

$(window).unload(function()
{
cometd.reload();
});
{code}

Can you please try the code above and see if it works for you ?

> Reload extension creating two cookies with different path
> ---------------------------------------------------------
>
> Key: COMETD-350
> URL: http://bugs.cometd.org/browse/COMETD-350
> Project: CometD
> Issue Type: Bug
> Components: javascript-dojo
> Affects Versions: 2.4.0, 2.4.1
> Reporter: Saitz Peter
> Assignee: Simone Bordet
> Priority: Minor
> Fix For: 2.4.1
>
>

Saitz Peter (Commented) (JIRA)

unread,
May 17, 2012, 5:50:25 PM5/17/12
to comet...@googlegroups.com

[ http://bugs.cometd.org/browse/COMETD-350?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=10883#comment-10883 ]

Saitz Peter commented on COMETD-350:
------------------------------------

I see where you are going with this, not a bad solution but not proper in my opinion. Not general enough. "Cleaner" solution is to make ReloadExt erase cookie that it actually read.

Example:
Page is loaded at mydomain.com/app/mypath. If there is cookie org.cometd.reload existing with its path set to "/", the ReloadExt reads and erases that cookie. BUT, if there is second cookie existing with path set to "/app", reading cookie('org.cometd.reload') will select the one which better matches the URL path of "/app/mypath", in this case it is cookie with path "/app" (not "/"). So, ReloadExt should automatically erase cookie it actually read(not the "/" cookie by default).

In my specific case, my application knows the cookiePath after handshake response returns, which is too late to use your code.

The solution is very easy, add value of cookiePath as one of the values in the reload cookie itself, and that way when ReloadExt reads the cookie it knows cookie was read and which cookie should be erased.

> Reload extension creating two cookies with different path
> ---------------------------------------------------------
>
> Key: COMETD-350
> URL: http://bugs.cometd.org/browse/COMETD-350
> Project: CometD
> Issue Type: Bug
> Components: javascript-dojo
> Affects Versions: 2.4.0, 2.4.1
> Reporter: Saitz Peter
> Assignee: Simone Bordet
> Priority: Minor
> Fix For: 2.4.1
>
>

Simone Bordet (Commented) (JIRA)

unread,
May 18, 2012, 7:53:26 AM5/18/12
to comet...@googlegroups.com

[ http://bugs.cometd.org/browse/COMETD-350?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=10884#comment-10884 ]

Simone Bordet commented on COMETD-350:
--------------------------------------

Peter,

I cannot reproduce your problem with 2.4.1 (are you sure you are not using cached-by-the-browser older JavaScript CometD libraries ?).

While it is true that CometD, in your case, will erase the cookie at "/", that is not a problem, since the cookie at "/app" will expire in few seconds.
The fact that CometD erases the cookie at "/" does not create it in 2.4.1 (while it was creating it in 2.4.0, hence this bug, see my comment on 11 Apr above).

You comment on 6 May, where you still see a session reload cookie for "/" tells me you're probably not using the correct CometD JavaScript file.

However, I agree that the ReloadExtension should clear the cookie it reads, so I am making this change.

> Reload extension creating two cookies with different path
> ---------------------------------------------------------
>
> Key: COMETD-350
> URL: http://bugs.cometd.org/browse/COMETD-350
> Project: CometD
> Issue Type: Bug
> Components: javascript-dojo
> Affects Versions: 2.4.0, 2.4.1
> Reporter: Saitz Peter
> Assignee: Simone Bordet
> Priority: Minor
> Fix For: 2.4.1
>
>

Simone Bordet (Resolved) (JIRA)

unread,
May 18, 2012, 8:22:25 AM5/18/12
to comet...@googlegroups.com

[ http://bugs.cometd.org/browse/COMETD-350?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Simone Bordet resolved COMETD-350.
----------------------------------

Fix Version/s: 2.4.2
Resolution: Fixed

Fixed.
Now the reload extension clears the cookie with its own path, instead of clearing a cookie with the initial configuration path.

> Reload extension creating two cookies with different path
> ---------------------------------------------------------
>
> Key: COMETD-350
> URL: http://bugs.cometd.org/browse/COMETD-350
> Project: CometD
> Issue Type: Bug
> Components: javascript-dojo
> Affects Versions: 2.4.0, 2.4.1
> Reporter: Saitz Peter
> Assignee: Simone Bordet
> Priority: Minor
> Fix For: 2.4.2, 2.4.1
Reply all
Reply to author
Forward
0 new messages