Version 0 of Toadhttpd

Updated 2018-09-19 15:28:20 by hypnotoad

Toadhttpd is an effort to extend the Httpd (tcllib) module into a fully functioning web server, in the style of Tclhttpd. The project actually started as version 4.0 of Tclhttpd, but it became readily apparent that the new coroutine and Tcloo based dispatch engine was completely irreconcilable with the old interpreter/procs named just so method of the old system. Rather than put out an incompatible new version, hypnotoad decided it was better to just roll it out as a new project.

Principle development is published as a fossil repository: https://chiselapp.com/user/hypnotoad/repository/toadhttpd/index

Toadhttpd is designed to install a complete snapshot of all of the code it depends on into a file location. In that way a production environment can support multiple version of Toadhttpd running different generations of the software.

To install an instance of Toadhttpd:

# Clone and upack the fossil sources
# Feel free to adjust the paths to your liking
mkdir -p ~/tcl/fossil/
fossil clone https://chiselapp.com/user/hypnotoad/repository/toadhttpd ~/tcl/fossil/toadhttpd.fos
mkdir -p ~/tcl/sandbox/toadhttpd
cd ~/tcl/sandbox/toadhttpd
fossil open ~/tcl/fossil/toadhttpd.fos

# Make a directory to host your content from
tclsh ~/tcl/sandbox/toadhttpd/make.tcl install ~/www/mysite
cd ~/www/mysite
ls
htdocs                httpd.tcl        log                modules                plugin                var
ls htdocs
hello.tml

To run the webserver:

tclsh httpd.tcl

If the file config.tcl is present in your directory, it will be read as a script during startup.

The default is to host the htdocs directory next to the httpd script as static content. However, like tclhttpd, you can embed template files that Tcl will perform substitutions on. The installer automatically drops in htdocs/hello.tml:

[my html_header {Hello World!}]
Your Server is running.
<p>
The time is now [clock format [clock seconds]]
[my html_footer]