Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: http scheme to support cookies

From: SunandaDH::aol::com at: 16-Apr-2005 6:15

Thomas:
> has anyone looked into adapting the default http scheme to support > cookies (ie. be able to set them and/or remember them across reads)?
There are several scripts in the Library that do things with cookies -- do a search on www.rebol.org for details. Cookies are fairly easy to handle anyway -- could you say what you see the advantages would be to extending the scheme? Basic cookie handling: To set a session cookie -- just print it as part of the HTTP headers: my-cookie: "name=data" print join "set-cookie: " my-cookie To set a longer cookie -- just add an expiry date: my-cookie: "name=data ; expires=" to-idate now + 31 ;; 31 days print join "set-cookie: " my-cookie To access a cookie: my-cookie: select system/options/cgi/other-headers "HTTP_COOKIE" Things are slightly more complicated if you have multiple cookies. Some code assistance may be useful there. Sunanda.