artanis
[Top][All Lists]
Advanced

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

Re: Me want cookie.


From: Mortimer Cladwell
Subject: Re: Me want cookie.
Date: Sun, 17 Jan 2021 08:10:25 -0500

Thanks Nala,

Looks like :cookies-remove! is now working.
:cookies-value is not.  When evaluated the cookie name is returned, not the value i.e.
(:cookies-value rc  "prjid") ==> "prjid"

I still don't understand the purpose of (:cookies-ref rc 'prjid "prjid")?  It gives the same results as :cookies-check
Thanks
Mortimer

On Sun, Jan 17, 2021 at 12:07 AM Nala Ginrut <mulei@gnu.org> wrote:

Hi Mortimer!

Mortimer Cladwell writes:

> 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.

There're 3 issues here, let me check it one by one:

1. :cookies-remove! has a bug that domain was set to "/" by defautlt, when it's going
to be expired. If so, the client reject to remove the cookie, now it's
fixed in both master and fix/ssql-guile3.

2. Yes, :cookies-check will return the whole cookie. I've added another
API (:cookies-value rc "your_cookie_name") to get the value with cookie
name.

3. There two cookie related field in the rc (which means route-context):
rc-cookie is for the cookie sent from the client;
rc-set-cookie is for the cookies need to add/modify/upate from the
server-side.

The API only affects rc-set-cookie that handles new cookies from the server-side:
:cookies-ref
:cookies-set!
:cookies-setattr!
:cookies-update!

The API only affects rc-cookie that handles cookies of the client:
:cookies-remove!
:cookies-check
:cookies-value

Folks may consider rc-set-cookie is a bad name, however, it's a hidden
low-level detail, folks may just ignore its existance, and handle it
with the API. Anyway, it can be any name distincted from rc-cookie.

Best regards

--
GNU Powered it
GPL Protected it
GOD Blessed it
HFG - NalaGinrut
Fingerprint F53B 4C56 95B5 E4D5 6093 4324 8469 6772 846A 0058

reply via email to

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