RejectedSoftware Forums

Sign up

Cookies

Hello,

I am attempting to set the max age of a cookie but the browser shows Expiration/Max-Age as "session":

Cookie cooky = new Cookie();
cooky.maxAge = 10;
cooky.value = "boo!";
res.cookies["my_cooky"] = cooky;
res.redirect("/index.html");

Am I missing a step ?

Thanks,
Josh

Re: Cookies

Am 25.09.2013 08:03, schrieb Joshua Niehus:

Hello,

I am attempting to set the max age of a cookie but the browser shows Expiration/Max-Age as "session":

Cookie cooky = new Cookie();
cooky.maxAge = 10;
cooky.value = "boo!";
res.cookies["my_cooky"] = cooky;
res.redirect("/index.html");

Am I missing a step ?

Thanks,
Josh

Looks alright, and the cookie handling code seems to do the right thing,
too. I'll need to take a closer look later.

But what caught my eye was that all cookies are displayed as expiring
at the end of the session in my browser (Firefox Aurora) due to a
configuration setting, maybe that's the case for you, too?

Re: Cookies

On Wed, 25 Sep 2013 08:33:00 +0200, Sönke Ludwig wrote:

But what caught my eye was that all cookies are displayed as expiring
at the end of the session in my browser (Firefox Aurora) due to a
configuration setting, maybe that's the case for you, too?

Hi Sönke,

I checked my settings (Chrome) and they look good: for example, I'm allowing all sites to set local data etc..

Re: Cookies

On Wed, 25 Sep 2013 07:06:23 GMT, Joshua Niehus wrote:

On Wed, 25 Sep 2013 08:33:00 +0200, Sönke Ludwig wrote:

But what caught my eye was that all cookies are displayed as expiring
at the end of the session in my browser (Firefox Aurora) due to a
configuration setting, maybe that's the case for you, too?

Hi Sönke,

I checked my settings (Chrome) and they look good: for example, I'm allowing all sites to set local data etc..

Sorry, got distracted by other things. I've created a github issue for now and will take a closer look in the coming days.

Re: Cookies

pull request to fix - https://github.com/rejectedsoftware/vibe.d/pull/334

Re: Cookies

Am 04.10.2013 11:34, schrieb Jack Applegame:

pull request to fix - https://github.com/rejectedsoftware/vibe.d/pull/334

Thanks, much appreciated!

Re: Cookies

I have a question

How modify existing cookie, for example remove?

Re: Cookies

Am 15.10.2013 21:11, schrieb Roman:

I have a question

How modify existing cookie, for example remove?

Both can be done using HTTPServerResponse.setCookie(name, value). If
value is null, the cookie will be removed and updated otherwise.