newLISP Fan Club

Forum => Anything else we might add? => Topic started by: CaveGuy on June 18, 2007, 10:43:13 AM

Title: (context 'CGI) ; get cookies feature
Post by: CaveGuy on June 18, 2007, 10:43:13 AM
The "get cookies" code that builds CGI:cookies from "HTTP_COOKIE" in cgi.lsp tears up cookies with embeded or tailing "=".



The following, fixed the problem, nicely for me.



(if (env "HTTP_COOKIE")

    (dolist (elmnt (parse (env "HTTP_COOKIE") ";"))

         (set 'var (trim (first (parse elmnt "="))))

 ### (set 'value (trim (last (parse elmnt "="))))

         (set 'value (slice elmnt (+ 1 (find "=" elmnt))))

         (push (list var value) cookies))

    (set 'cookies '()))



This feature plays hell with (base64-*) and (encrypt) of cookies !



I had been chaseing a random problem for weeks before I figured out how to reporduce it. In my case a (base64 string with a trailing "=" came back "" which trigered a differant, repeatable, error, that lead to this fix.

Well back to my rat killen, Just thought someone else might have a random cookie related problem that this might fix.
Title:
Post by: Lutz on June 18, 2007, 10:47:49 AM
Thanks for this fix, it will go into the next development version 9.1.9



Lutz
Title:
Post by: rickyboy on June 18, 2007, 12:29:48 PM
Another tagline for newLISP: "newLISP: It's so easy, even a CaveGuy can do it."



(You might have to watch too much American TV to get this.  Sorry abroaders.)



Thanks for the fix Bob!