Hi Tomas and Henrik,

ok, ok, now as there is such a _huge_ demand for cookies ;-)

I was always reluctant to include any cookie support at all, as the http
and form frameworks are designed to work without them, and I privately
consider cookies a bad design issue.

> (de cookie @
>    (let At (rest)
>       (if (assoc (car At) "*Cookies")
>          (con @ (cdr At))
>          (push '"*Cookies" At) ) ) )

I would suggest a slight modification:

   (de cookie @
      (if (assoc (next) "*Cookies")
         (con @ (rest))
         (push '"*Cookies" (cons (arg) (rest))) ) )

This needs one 'cons' less (in the (rest) calculation), but should
otherwise be equivalent.

> (de httpCookie (K V P E D S H)
>    (prin "Set-Cookie: " (ht:Fmt K) "=" (ht:Fmt V) "; path=" (or P "/"))
>    (when E (prin "; expires=" @))
>    (when D (prin "; domain=" @))
>    (when S (prin "; secure"))
>    (when H (prin "; HttpOnly"))
>    (prinl) )
> (de httpCookies ()
>    (mapc httpCookie "*Cookies") )

Are you sure that this works as expected? 'mapc' with a function of
seven arguments expects seven lists as arguments.

I would suggest the following:

   (de httpCookies ()
            (prin "Set-Cookie: "
               (ht:Fmt (pop 'L)) "=" (ht:Fmt (pop 'L))
               "; path=" (or (pop 'L) "/") )
            (and (pop 'L) (prin "; expires=" @))
            (and (pop 'L) (prin "; domain=" @))
            (and (pop 'L) (prin "; secure"))
            (and (pop 'L) (prin "; HttpOnly"))
            (prinl) )
         "*Cookies" ) )

I have put this into the current testing version.
Please let me know if it is all right.

- Alex
UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe

Reply via email to