#2 Contribution: FIND-COOKIE

Sean Champ


I thought that I might offer the following method
code, while it's occurring to my attention.

[In case it would be of any question: I wrote the
following simple thing]

(defmethod find-cookie ((cookie-name string)
(cookie-jar cookie-jar))
(find cookie-name (cookie-jar-items cookie-jar)
:test (lambda (ckname ckdat)
(let ((cookie (cadr ckdat)))
(string= ckname
(cookie-item-name cookie))))))

The method, of course, is made to find a cookie
named COOKIE-NAME (a string) in a
COOKIE-JAR (a cookie-jar object).

As for the value that the function would return,
on success -- generally put -- the value (if not
NIL) would be an element of the list, such that
would be returned by COOKIE-JAR-ITEMS -- a
list, then, with the cookie's established
hostname, as the first element , and a
COOKIE-ITEM object, as the second element.

I am "open for any commentary", about that
method, of course.

I just thought that I might offer it, here, in case it
would be regarded as being worth including,
somewhere in the AServe code.

I can reformat that simple documentation for the
method, either, and include it in aserve.html, and
provide the patch, if wanted -- "no problemo."


Log in to post a comment.