Hi Nala,
Below is my test of cookies with the fix/ssql-guile3 branch on Debian 10 Chromium browser.
Controllers:
-----BEGIN-------------------------------------------------------------------
(plateset-define cset
(options #:cookies '(names prjid sid))
(lambda (rc)
(let* ((dummy (:cookies-set! rc 'prjid "prjid" "1000"))
(result "empty")
(cookies (rc-cookie rc)))
(view-render "test" (the-environment)))))
(plateset-define check
(lambda (rc)
(let* ((result (:cookies-check rc "prjid"))
(cookies (rc-cookie rc)))
(view-render "test" (the-environment)))))
(plateset-define ref
(lambda (rc)
(let* ((result (:cookies-ref rc 'prjid "prjid"))
(cookies (rc-cookie rc)))
(view-render "test" (the-environment)))))
(plateset-define haskey
(lambda (rc)
(let* ((cookies (rc-cookie rc))
(result (cookie-has-key? cookies "prjid")) )
(view-render "test" (the-environment)))))
(plateset-define remove
(options #:cookies '(names prjid sid))
(lambda (rc)
(let* ((dummy (:cookies-remove! rc 'prjid))
(result "empty")
(cookies (rc-cookie rc)) )
(view-render "test" (the-environment)))))
------END----------------------------------------------------------------------
----BEGIN-----------View-------------------------------------------------------
result: <%= result %><br>
cookies: <%= cookies %><br>
------END----------------------------------------------------------------------
Below I show the view results as well as what I see in the Chromium cookies browser. The results are in the chronological order of submission of each of the controllers. I start with no cookies. I am showing the test page source code so we can see the structure contents:
1 ---------------------
127.0.0.1:3000/plateset/check result: prjid<br>
cookies: ()<br>
Chromium cookies console: empty
2 ------------------------
127.0.0.1:3000/plateset/refresult: prjid<br>
cookies: ()<br>
Chromium cookies console: empty
3 ---------------------
127.0.0.1:3000/plateset/haskeyresult: #f<br>
cookies: ()<br>
Chromium cookies console: empty
4 ---------------------
127.0.0.1:3000/plateset/cset result: empty<br>
cookies: ()<br>
Chromium cookies console: cookie and value visible
5 ---------------------
127.0.0.1:3000/plateset/checkresult: prjid<br>
cookies: (#<cookie nvp: (("prjid" "1000")) expires: #f domain: #f path: #f secure: #f http-only: #f>)<br>
Chromium cookies console: cookie and value visible
6 ---------------------
127.0.0.1:3000/plateset/refresult: prjid<br>
cookies: (#<cookie nvp: (("prjid" "1000")) expires: #f domain: #f path: #f secure: #f http-only: #f>)<br>
Chromium cookies console: cookie and value visible
7 ---------------------
127.0.0.1:3000/plateset/haskeyresult: #<cookie nvp: (("prjid" "1000")) expires: #f domain: #f path: #f secure: #f http-only: #f><br>
cookies: (#<cookie nvp: (("prjid" "1000")) expires: #f domain: #f path: #f secure: #f http-only: #f>)<br>
Chromium cookies console: cookie and value visible
8 ---------------------
Manually delete cookie in the Chromium console
results repeat as at step 1 onward....
=======================================
Results:
** :cookies-set! Seems to work - adds a cookie that is visible in the browser console
** :cookies-check & :cookies-ref report the cookie name "prjid" independent of cookies existence
** cookie-has-key? initially #f. After :cookes-set! contains the cookies structure regardless of which additional commands are issued including :cookies-remove! Only manually deleting the cookie in the browser console resets cookie-has-key? to #f
** (cookies (rc-cookie rc)) cookies variable is loaded with the cookies structure after :cookies-set!. No other commands seem to affect it. Manual deletion of the cookie in the browser console resets cookies to #f
** (:cookies-remove! rc key) ; remove cookie from client <== from the manual. When I tried there was no effect on browser cookies. You did not mention this in your last message indicating the API. Is it supposed to work - can we use it?
It seems like the (cookies (rc-cookie rc)) variable is accurately reflecting the contents of the browser cookies.
What is supposed to be the difference between :cookies-check & :cookies-ref ? I thought (:cookies-ref rc 'prjid "prjid") would retrieve the value - if not what does it do and is there a method to retrieve the value '1000'? cookie-has-key? gives the entire structure.
Thanks
Mortimer