Hi Thomas,

On Saturday, April 16, 2005, 2:17:14 PM, you wrote:

TC> the scripts in question basically hacked functionnality on top of
TC> rebol instead of doing it within rebol. they use weird global
TC> variables called "cookie-data" and "cookie-data2" instead of the
TC> common datastructure for ports and protocols, they use weird function
TC> interfaces such as "tmp: HTTP-TOOLS http://www.rebol.com []" (to fetch
TC> a page which sends you a cookie) instead of the familiar read...

I agree, however I'm not sure about making REBOL deal with cookies
"automatically".

Anyway, the functionality is almost already there.

>> p: open http://www.qtask.com/
connecting to: www.qtask.com
>> probe p/locals

make object! [
    list: []
    headers:
    make object! [
        Date: "Sat, 16 Apr 2005 14:28:09 GMT"
        Server: "Apache/2.0.52 (Fedora)"
        Last-Modified: none
        Accept-Ranges: none
        Content-Encoding: none
        Content-Type: "text/html; charset=iso-8859-1"
        Content-Length: none
        Location: none
        Expires: "Sat, 16 Apr 2005 14:28:09 GMT"
        Referer: none
        Connection: "close"
        Authorization: none
        Set-Cookie: "previousurl=http%3A%2F%2Fwww.qtask.com%2Findex.cgi"
        Vary: "Accept-Encoding"
        Cache-Control: "max-age=0, must-revalidate"
    ]
]

You  can  get  the cookie from p/locals/headers/Set-Cookie, except
that  PARSE-HEADER has problems with repeated headers and you only
get  to  see  the last one in the object. A quick hack migth be to
read directly header-rules/head-list which has all of them.

You  can  send cookies back using the /CUSTOM refinement. Here the
problem of using repeated headers is harder to workaround, and you
probably  need  to  poke  into  the  handler code to make it work;
anyway, it's something like:

   read/custom http://somesite/ [
       header [Cookie: "my-cookie=something"]
   ]

I  think  that  some  of these problems have been fixed during the
View 1.3 project.

Regards,
   Gabriele.
-- 
Gabriele Santilli <[EMAIL PROTECTED]>  --  REBOL Programmer
Amiga Group Italia sez. L'Aquila  ---   SOON: http://www.rebol.it/

-- 
To unsubscribe from the list, just send an email to 
lists at rebol.com with unsubscribe as the subject.

Reply via email to