artanis
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Me want cookie.


From: Mortimer Cladwell
Subject: Me want cookie.
Date: Wed, 9 Dec 2020 16:18:34 -0500

Hello!

Cookies don't seem to be working for me.  I test the below controllers on both Chrome and Firefox.
On Debian 10, Guile 3.0.4 using Artanis branch fix/ssql-guile3.

Controllers:

---BEGIN-----/plateset/test----------------------------------------------
(plateset-define test
 (options #:cookies '(names prjid sid))
 (lambda (rc)
   (let* ((cookies (rc-cookie rc))
 (acookie (:cookies-ref rc 'prjid "prjid")))
 (view-render "test" (the-environment)))))
---END-------------------------------------------------------------------

---BEGIN-----/plateset/testadd-------------------------------------------
(plateset-define testadd
 (options #:cookies '(names prjid sid))
 (lambda (rc)
   (let* ((dummy (:cookies-set! rc 'prjid "prjid" "1000"))
 (cookies (rc-cookie rc))
 (acookie (:cookies-ref rc 'prjid "prjid")))
   (view-render "test" (the-environment)))))
---END-------------------------------------------------------------------

---BEGIN-----/plateset/testdelete----------------------------------------
(plateset-define testdelete
 (options #:cookies '(names prjid sid))
  (lambda (rc)
  (let* ((dummy (:cookies-remove! rc "prjid"))
 (cookies (rc-cookie rc))
 (acookie (:cookies-ref rc 'prjid "prjid")))
   (view-render "test" (the-environment)))))
---END-------------------------------------------------------------------

View:

---BEGIN------test.html.tpl----------------------------------------------
<html></body>
  <h1>Test</h1><br><br>
  cookies: <%= cookies %><br>
  acookie:  <%= acookie %><br>
</body></html>
---END-------------------------------------------------------------------

Firefox results first:

I clear all cookies and load /plateset/test and see the view:
cookies: ()
acookie: #f

I load /plateset/testadd and see:
cookies: ()
acookie: 1000
"prjid" is present in the cookies via browser console.

I reload /plateset/test and see:
cookies: (#)
acookie: #f
"prjid" is still present in the cookies via browser console!
If I look at the terminal (art work) output, I also see "prjid" in the header:

 (connection keep-alive) (cookie . "prjid=1000") (upgrade-insecure-requests . "1") (if-modified-since . #<date nanosecond: 0 second: 30 minute: 39 hour: 14 day: 9 month: 12 year: 2020 zone-offset: 0>)) meta: () port: #<input-output: socket 22>>
 
 If I load /plateset/testdelete I see:
 cookies: (#)
acookie: #f
But "prjid" is present in both header and cookies on the browser console!

Chrome results:

HTML view gives the same results as Firefox however cookies never appear in the browser console nor in the header visible in art work terminal output.

My expectation is that (rc-cookie rc) would provide a list of key/value pairs of all cookies - retrieved from the header - while (:cookies-ref rc 'prjid "prjid") provides the value of a single cookie, "prjid" in this case.  Is that correct?

(rc-cookie rc) does not seem to work at all.
I can add a cookie with (:cookies-set! rc 'prjid "prjid" "1000") in Firefox, but I can only retrieve that cookie in the same method invocation i.e. all future attempts at retrieval fail.
(:cookies-remove! rc "prjid") does not seem to work in Firefox.  Since a cookie is never visible in Chrome web console, can't evaluate :cookies-remove!
What am I doing wrong?
Thanks
Mortimer



reply via email to

[Prev in Thread] Current Thread [Next in Thread]