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

[REBOL] Re: http scheme to support cookies

From: thomas::cr::gmail::com at: 16-Apr-2005 14:17

it might not have been clear based on the end of your reply, what i'm interested in is handling cookies on the client side, not in a cgi.
> > 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.
yes in fact, i've tried them (cookies-client.r and http-tools.r) but couldn't get them to work for the site i tried (nytimes).
> Cookies are fairly easy to handle anyway
kind of, in the same way that the rest of http is... if you look at the scripts you talk about, they're still 250 lines of code.
> could you say what you see the > advantages would be to extending the scheme?
i didn't really ask myself the question in these terms... disclaimer: i have never tried to write a scheme so i might be totally wrong! rebol deals with network protocols using what it call schemes. and it was designed so that people could add and extend these schemes. the advantage of doing this is that each protocol deals with its details within the scheme but uses a standard interface with the rest of rebol. which is why you can use the same 'read' with pop, http, ftp... this is a _good_ thing. it makes things more elegant. code is easier to read and write for users, functionnalities and new protocols are easier implement... i don't have anything against the authors of those scripts, they probably didn't know about schemes or were impressed by them (as you seem to be). what they ended up doing doesn't seem to me to correspond to how rebol was intended to be used. it is quite confusing to use for users and i bet their implementation has been more complicated than if they had used a scheme. the scripts in question basically hacked functionnality on top of rebol instead of doing it within rebol. they use weird global variables called "cookie-data" and "cookie-data2" instead of the common datastructure for ports and protocols, they use weird function interfaces such as "tmp: HTTP-TOOLS http://www.rebol.com []" (to fetch a page which sends you a cookie) instead of the familiar read... tc