Webserver example in chapter 13

Skip to first unread message


Sep 6, 2012, 4:11:20 PM9/6/12
to land-o...@googlegroups.com
The code on the server for the webserver.lisp example has some issues but the book apparently has it right (FYI), so if you just copy the code at the book's website and try to use it, it'll blow up on you.

When I launch the website from Firefox, all it does is print the HTML as plain text on the screen on a white background as if it doesn't have a clue what HTML is.  However if I use Google Chrome, it interprets the HTML and behaves as shown on page 266 of the book, where Dr. Barski is in fact using Firefox....is this governed by some setting in Firefox that I need to change or what?  Can anyone please help me here?

Purity Control

Sep 7, 2012, 3:51:46 AM9/7/12
to land-o...@googlegroups.com
I think this is due to changes in Firefox since the book was published and what information it expects to be able to render html.

A previous discussion on this matter is here and it may help you

Hope this helps

Yuyang Liu

Sep 7, 2012, 5:37:05 AM9/7/12
to land-o...@googlegroups.com
just add
HTTP/1.1 200 OK

before what the server passed to firefox

2012/9/7 Purity Control <cr...@puritycontrol.net>

yours sincerely


Sep 10, 2012, 6:19:33 PM9/10/12
to land-o...@googlegroups.com
Thanks to the two people who replied.  I'll try what you suggested.


Nov 17, 2012, 3:50:47 PM11/17/12
to land-o...@googlegroups.com
Yeap, that worked for me.


Silvio Rispoli

Jul 23, 2015, 11:19:11 AM7/23/15
to Land of Lisp, lht...@gmail.com
I encountered the same issue, and tried to add the "HTTP/1.1" response thingy :D .. But it didn't work for me: I kept being responded with the dump of the code on the web browser. Could you attach to a response how  dice_of_doom_v3.lisp should look like? Just the defun is fine, so that no security exposure is created, if you know what I mean :)

Thanks in advance,

Simon Nicolussi

Jul 23, 2015, 4:26:56 PM7/23/15
to land-o...@googlegroups.com
Does this work for you? I only changed the third line.

(defun dod-request-handler (path header params)
(if (equal path "game.html")
(progn (format t "HTTP/1.0 200 OK~2%<!doctype html>")
(tag center ()
(princ "Welcome to DICE OF DOOM!")
(tag br ())
(let ((chosen (assoc 'chosen params)))
(when (or (not *cur-game-tree*) (not chosen))
(setf chosen nil)
(cond ((lazy-null (caddr *cur-game-tree*))
(web-announce-winner (cadr *cur-game-tree*)))
((zerop (car *cur-game-tree*))
(when chosen
(read-from-string (cdr chosen)))))
(t (web-handle-computer))))
(tag br ())
(draw-dod-page *cur-game-tree* *from-tile*)))
(princ "Sorry... I don't know that page.")))

Simon Nicolussi <si...@sinic.name>

Silvio Rispoli

Jul 23, 2015, 4:49:03 PM7/23/15
to Land of Lisp, si...@sinic.name
It does, thank you :D .. I owe you one..

Reply all
Reply to author
0 new messages