[plt-scheme] Send session cookie via get-pure-port

From: YC (yinso.chen at gmail.com)
Date: Tue Dec 1 22:47:43 EST 2009

The cookie header needs to be passed in as a single string that has the
format of "Header: Value", i.e.,

(get-pure-port <url> (list *"Cookie: <key>=<value>; <key2>=<value2>..."*))

If you need to make SSL requests, you can use my bzlib/http package's
http-get, which uses list of key/value pairs as strings:
http://planet.plt-scheme.org/display.ss?package=http.plt&owner=bzlib

(require (planet bzlib/http/client))

(http-get <url> `(("Cookie" . "<key>=<value>; <key2>=<value2>...")))

You can of course use net/cookie to generate the the cookie header values
via print-cookie.

http://docs.plt-scheme.org/net/cookie.html#(def._((lib._net/cookie..ss)._print-cookie))

Cheers,
yc


On Tue, Dec 1, 2009 at 1:28 PM, Ralf Seliger <admin at kreidestaub.de> wrote:

> Hi,
>
> I want to download the contents of a certain news article using
> get-pure-port. I know the exact URL of the article. The site requires a
> session cookie to grant access to article. After registering and logging in
> manually via browser I have determined the name and the value of the current
> session cookie.
>
> Now I figure that all I have to do is call get-pure-port according to
> (get-pure-port URL [header]) and pass along the cookie using the optional
> header parameter. What I can't figure out, though, is how to put together
> the header such that the server accepts the cookie and  grants access to the
> article.
>
> Any help would be appreciated.
>
> Regards,
>
> Ralf Seliger
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20091201/138750f5/attachment.html>

Posted on the users mailing list.