[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] experimenting with http-server
From: |
felix winkelmann |
Subject: |
Re: [Chicken-users] experimenting with http-server |
Date: |
Wed, 25 May 2005 07:43:23 +0200 |
On 5/24/05, Michele Simionato <address@hidden> wrote:
> I was trying to see if I can get working a simple Web application using
> http-server, spiffy-utils, etc. Here are the issues I am having:
>
> - the error messages. There are NO error messages! Even if I start the
> server with the debug option ((http:make-server 4242) #t))) I don't
> see them; even if I play with http:error-hook I can't see them
> (I am trying to set error-hook to print the error message on stderr)
I would recommend to use spiffy instead iof the raw http extension.
The most convenient way is to use either .ssp pages or
`define-http-resource'. These should show the error messages in
the generated web-page.
>
> - how do I gracefully stop the server? CTRL-C does not work, it seems I
> have to kill it by hand.
There is currently no way to gracefully terminate the server. I haven't
found yet a decent method of handling all pending requests before
terminating (but I'll take a look and see what I can do).
>
> I have found this code in Chris Double modal Web server example:
>
> (set! ##sys#read-prompt-hook
> (lambda ()
> (when (or (##sys#fudge 12)
> (##sys#tty-port?
> (current-input-port)))
> (display "#;> ")
> (flush-output)
> (##sys#thread-block-for-i/o! ##sys#current-thread 0 #t)
> (thread-yield!))))
>
> (thread-start!
> (lambda () ((http:make-server 4242) #t))); de
>
> This works fine, but why this is not the standard behavior of Chicken?
It is, starting with version 1.89. Here is a simple example that
should run the server under csi in a separate thread without blocking
the REPL:
; this uses spiffy:
(define (spiff . args)
(thread-start!
(lambda ()
(apply start-server (append args (list root: "~/stuff" port: 8080
debug: #t))) ) ) )
cheers,
felix