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

From: Justin Paston-Cooper (paston.cooper at gmail.com)
Date: Fri Feb 22 07:41:53 EST 2008

(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?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20080222/81fda0a9/attachment.html>

Posted on the users mailing list.