(chibi net http-server)

(run-http-server listener-or-addr servlet [cfg])

Runs an http server listening at the given address, with the given servlet.

A servlet is a procedure which takes four arguments: a (chibi config) config object, an Http-Request record, which contains the I/O ports and parsed request and headers; a next procedure to call the next available servlet if any, and a restart procedure to restart the servlets with a new request.

The default config parameters are:

A simple page view counter could be run as:

(let ((count 0)) (run-http-server 8000 (lambda (cfg request next restart) (set! count (+ 1 count)) (servlet-write request (sxml->xml `(html (body (p ,count))))))))

(http-chain-servlets f . o)

(http-wrap-default servlet)

(http-guard-servlet cfg request next restart)

(http-file-servlet [dir index-rx])

(http-procedure-servlet path proc)

(http-regexp-servlet rules get-field)

(http-uri-regexp-servlet rules)

(http-path-regexp-servlet rules)

(http-host-regexp-servlet rules)

(http-regexp-replace-servlet rules helper)

(http-redirect-servlet rules)

(http-rewrite-servlet rules)

(http-cgi-bin-dir-servlet local-dir [virtual-dir])

(http-scheme-script-dir-servlet local-dir [virtual-dir index-rx])

(http-ext-servlet rules local-dir [virtual-dir])

(http-default-servlet cfg request next restart)