Re: HTTP request handler / middleware SRFI
Lassi Kortela 05 Apr 2019 13:11 UTC
Here's the Common Lisp equivalent: clack (http://quickdocs.org/clack/)
Maybe we could start by imitating the Common Lisp/Racket/Clojure
abstractions very closely. And only deviate from those if we encounter
problems.
Usually the request headers come in an association list, and response
headers go out in another alist.
The response body presents a bigger question (and the request body as
well -- we have to be able to read HTML forms, JSON and uploaded files
from it). It's nice to just be able to do return the response body as a
string. But we have to consider situations where a web app wants to
write a 500 MiB file to the client (e.g. a backup or something). In
those cases we need to be able to write the response in chunks.
Probably we also need to be able to read the request body in chunks in
case the client sends a huge photograph or video or ZIP archive or
something.