[racket] Racket Web Server

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Tue Sep 6 07:24:46 EDT 2011

The documentation you are reading:


is for version 5.0.1, but you are running 5.1.3.

If you look at the documentation for the version you are using:


You'll see the example program is different due to changes from 5.0.1 to 5.1.3


On Mon, Sep 5, 2011 at 7:06 PM, Jeremy Kun <kun.jeremy at gmail.com> wrote:
> Hi there,
> I used the Racket web server a few years ago, and returning to it now I'm
> having trouble getting it set up on my home computer (Win Vista, DrRacket
> version 5.1.3).
> So I went to Continue: Web Applications in Racket to do the hello world
> program, which I will later practice deploying on a real web server.
> Unfortunately the hello world program from the above link doesn't work on my
> machine. First, I press Run in Dr. Racket, and the web page pops up with a
> "Could not connect" message, which I eventually found out was because
> "localhost" wasn't bound to on my machine. Go figure. After
> replacing localhost with, I get an error with the following stack
> trace:
> Servlet (@ /servlets/standalone.rkt) exception:
> start: self-contract violation, expected <can-be-response?>, given: '(html
> (head (title "My Blog")) (body (h1 "Under construction")))
>   contract from you, blaming you
>   contract:
>     (-> request? can-be-response?)
> The program itself is copy-pasted from the webpage, and compiles without
> error. Can anyone give me a clue as to what might have gone wrong? I have no
> idea how the contract structure works, so the error message is a bit
> baffling.
> On another note, I tried running the servlet in multiple browsers (hoping
> that something as silly as that wasn't the problem), and I noticed that in
> IE7 the css for the error message is a bit off. If the Racket devs care
> about that sort of thing (I sure don't, but who knows?) then they might want
> to fix that. I've attached a screenshot of the error in IE7 here.
> I appreciate any words of wisdom to help me get this server running, and I'm
> certainly willing to learn something new to fix it.
> Regards,
> Jeremy
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users

Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University

"The glory of God is Intelligence" - D&C 93

Posted on the users mailing list.