[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Problems with :cookies-setattr!
From: |
Mortimer Cladwell |
Subject: |
Problems with :cookies-setattr! |
Date: |
Thu, 28 Jan 2021 09:52:58 -0500 |
Hi,
Using the following controller I can set a cookie "prjid"
----BEGIN----------------------------------------------
(plateset-define cset
(options #:cookies '(names prjid sid))
(lambda (rc)
(let* ((result "sometext")
(dummy (:cookies-set! rc 'prjid "prjid" result))
(cookies (rc-cookie rc)))
(view-render "test" (the-environment)))))
----END------------------------------------------------
In the Firefox console I see:
Name: prjid
Value: sometext
Domain: 127.0.0.1
Path: /plateset
Expires: Thu, 28 Jan 2021 15:25:19 GMT (this is one hour in the future)
Size: 13
HttpOnly: true
Secure: false
SameSite: none
I want to modify the Expires to 6 hours (21600 sec) into the future
----BEGIN----------------------------------------------
(plateset-define update
(options #:cookies '(names prjid sid))
(lambda (rc)
(let* (
(result (:cookies-setattr! rc 'prjid #:expires 21600 #:domain #f #:path #f #:secure #f #:http-only #f))
(cookies (rc-cookie rc))
(view-render "test" (the-environment)))))
----END------------------------------------------------
Doesn't work. I have tried matching some/all of the other parameters to the existing cookie without effect. I can:
(:cookies-setattr! rc 'prjid #:expires 21600 #:domain #f #:path "/junk" #:secure #f #:http-only #f)
To get:
Name: <blank>
Value: <blank>
Domain: 127.0.0.1
Path: /junk
Expires: Thu, 28 Jan 2021 20:39:24 GMT (6 hours into the future)
Size: 0
HttpOnly: true
Secure: false
SameSite: none
So here the path and expires are correct but no name - i.e. does not affect the existing cookie but creates a new blank cookie.
I assume :cookies-setattr! will only work on existing cookies, is that correct?
In addition to changing the expiration time I would like to change the path from "/plateset" to "/" so the cookie is available sitewide - should that be possible?
When setting a parameter to #f e.g. #:secure #f - does that mean change that parameter to #f or "don't modify that parameter"? Seems like all parameters are required.
What am I doing wrong?
Thanks
Mortimer
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Problems with :cookies-setattr!,
Mortimer Cladwell <=