This is a simple and lightweight single source file pure TCL webserver, that can easily be embedded. Dandelion because it is bigger than Dustmote (the smallest TCL web server) but still small and light.
The download contains another file with code extracted from ncgi plus two small procs of my own to deal with form data and cookies.
The documentation is in the source file. An HTML version of the source (generated by Simpledoc) is provided in the download archive to make it more readable. This may not sound friendly, but the first part of the source file is just documentation, and it should be easy to get going.
Requests are parsed, checked and passed to handler. The simple static_handler and simple_handler are provided as a examples.
The handler mostly receives the same as CGI variables in $headers dict. A major exception is that REQUEST_URI has had query string and fragment removed and been url decoded. Some other things are missing. Please see the output of simple_handler to see what is there.
The handler should include a “Connection: Close” header as keep alive is not supported. This is done by try_file and the example handler, and looking up the beginning of the response in ::dandelion::first_line is sufficient to ensure this.
- Serves static and dynamic pages.
- Can handle multiple simultaneous clients
- Can run multiple servers on different ports in a single process.
- Event driven so should be able to handle fairly high loads
- Lightweight enough to run large numbers of server processes on cheap hardware.
- Not well tested, but simple enough that it should run reliably.
- Limited testing of performance.
- Implements only a subset of HTTP/1.1. Important omissions below:
- No keep alive (and therefore no pipelining as well.This is allowed by the standard as long as Connection: Close is sent with each response.
- Absolute URLs in requests are not accepted.
- Chunked requests are not accepted.
- 100 Continue not sent (may be implemented by handler)
- If-Modified-Since and If-Unmodified-Since preconditions are ignored for static files. (may be implemented by handler)
Please let me know if you use Dandelion.