[plt-scheme] Incorporation of cookies into x-expression

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Fri Feb 22 09:38:16 EST 2008

You must (require web-server/private/response-structs)

Perhaps I should change this though, as it seems like it should be in
the standard API set.

Jay

On Fri, Feb 22, 2008 at 4:41 AM, Justin Paston-Cooper
<paston.cooper at gmail.com> wrote:
> (module tester
>   mzscheme
>
>   (require (lib "servlet.ss" "web-server")
>            (lib "xml.ss" "xml"))
>   (provide start interface-version timeout)
>
>   (define overall '())
>    (define timeout +inf.0)
>   (define interface-version 'v1)
>
>   (define (start initial-request)
>     (let ((req (extract-binding/single 'req
>                                        (request-bindings initial-request))))
>        (if (string=? req "yes")
>           (let ((cookie
>                  (extract-bindings 'cookie
>                                    (request-headers initial-request))))
>             (send/finish `(p ,(format "~a" cookie))))
>            (send/finish
>            (make-response/full 200 "None" (current-seconds) "text/html;
> charset=utf-8"
>                                '((cookie . '("Set-Cookie: NAME=hello;")))
>                                 (xexpr->string `(p "hello, sent"))))))))
>
> When I try to go to this page, I get the following error:
>
> Servlet didn't load. /home/justin/plw/./servlets/tester.ss:27:24: compile:
> unbound variable in module in: make-response/full === context ===
> /usr/lib/plt/collects/mred/private/snipfile.ss:192:10
> /usr/lib/plt/collects/web-server/dispatchers/dispatch-servlets.ss:281:4:
> load-servlet/path
> /usr/lib/plt/collects/web-server/dispatchers/dispatch-servlets.ss:264:4:
> reload-servlet-script ...ivate/cache-table.ss:38:46
> /usr/lib/plt/collects/web-server/private/cache-table.ss:30:11
> cache-table-lookup! select-handler/no-breaks select-handler/no-breaks
> select-handler/no-breaks dispatcher? dispatcher?
> /usr/lib/plt/collects/web-server/private/dispatch-server-unit.ss:73:10:
> connection-loop
>
> Why should make-response/full not be bound?
>



-- 
Jay McCarthy <jay.mccarthy at gmail.com>
http://jay.teammccarthy.org


Posted on the users mailing list.