On Thu, Feb 28, 2008 at 09:55:01AM +0100, minh thu wrote: > Hi > > I'm trying to use spiffy. I've a little problem which is in fact > related to the 'http' egg. > > Using the 'server example' from the 'http' wiki page with firefox, > firefox try to load the page for ever; it's only when I kill the > server (closing the port) that the page appears in firefox. > > How should I handle this ? Is the Content-Length header field > important for this ?
The example is incorrect. The write-response-header accepts the
request, the status code, the status message and the alist of headers.
The status code and message were left out. Sorry about that, I've
fixed it on the wiki.
The correct example is:
(require-extension http-server)
(http:add-resource '("/" "/index.html")
(lambda (r a)
(let ([msg "<h1>Hello, world!</h1>"])
(http:write-response-header
r
200
"OK"
`(("Content-type" . "test/html")
("Content-length" . ,(string-length msg))))
(display msg) ) ) )
((http:make-server 4242) #t)
Cheers,
Peter
--
http://sjamaan.ath.cx
--
"The process of preparing programs for a digital computer
is especially attractive, not only because it can be economically
and scientifically rewarding, but also because it can be an aesthetic
experience much like composing poetry or music."
-- Donald Knuth
pgp8GBhGh3Mn2.pgp
Description: PGP signature
_______________________________________________ Chicken-users mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/chicken-users
