I'm trying to figure out how to use a config file to set up (chibi net http-server), but I haven't been able to find an example. Does anyone have a simple one, e.g. one that serves a static directory as well as a POST handler?
Thanks.
Here's one example:
https://github.com/ashinn/snow-fort/blob/master/config.scm
There's also the example at the bottom of http-server.scm:
chibi-scheme -Rchibi.net.http-config-server -- [<cfg-file-or-directory>]
with no config it's useful for just serving a file browser.
;; A servlet handler has been set, so we're in a persistent server.
Ah, a long-standing bug, presumably in the thread scheduler :(
I actually run snow-fort in a while loop:
while true; do chibi-scheme -Rchibi.net.http-server --
snow-fort/config.scm; done
I'll bump the priority into looking into this now that I'm reminded.
Anyway, I pushed the trivial fix of ignoring SIGPIPE when running an
http server.
Excellent. It works for me. I'm glad that it wasn't a threading bug. Those can be tough to catch.
I figured out the reason for the client disconnects: the server was sending the wrong Content-Type
in many cases. On HTTP/1.1 connections when more than one resource was being delivered, that made the client (at least Google Chrome) hiccup. I just sent a pull request that fixes that for many file extensions. It might be better not to have a default MIME type, but I didn't make that change.