Using the link below, download a tarball containing the source code for a web server written in Scheme and C.
A bit of history. The server project was originally started in 2008 to create a web site for an arts organization. Choosing Scheme to implement the server was the direct result of realizing Scheme's template forms were so naturally expressive of HTML's hierarchical structure. I reasoned that it would be straightforward to show "web designers" (already familiar with HTML) how easy it is to write web pages in Scheme to be served up by the server.
Ultimately the organization decided not to proceed with the project. However, a merit of Scheme is that the original version was created in less than two months and already quite usable. It seemed a shame to discard the project, and since I had other ways to use it, development continued.
Over the subsequent four years, the code has been revised and refined several times. In particular, the server's Scheme-implemented bidirectional "iochannels" achieve intuitive usability and efficient performance, but now also allow better interoperability with standard Scheme input/output ports, maximizing programming flexibility and ease of use.
The most recent (and substantial) changes were made from Sep 2012 through April 2013. Many bugs were fixed, and support for web-based email clients and MIME protocol processing was improved. During Mar/Apr 2013 the focus was on major enhancements to security, performance, and operational reliability. But as always, it remains a work in progress.
The server is implemented as a multiplexed, multitasking, compiled, embedded Scheme-in-C application, using CHICKEN Scheme and its embedding API. This approach provides advantages in stability, low-memory use, and performance, leveraging the capabilities of the Scheme and C implementations, and avoiding some of the potential pitfalls of both. Alas, while it's not yet completed, the plan is still having available a detailed description of its inner workings, a tour through the code.
The project has achieved a milestone! Development source code (and more) is now available in a FOSSIL repository hosted on this site. (SEE BELOW). Of course, comments, feedback, bug-reports are still welcome: 'sourcecode at bmedctr dot com'.
Features of the server:
Of course, CHICKEN scheme must be installed in order to compile the server. Once the server tarball is expanded, change to the "embed" directory, and at a shell prompt, enter "make" (or "gmake" on BSDs), and then "make install". The default installation prefix is '/usr/local', but of course this can be changed by editing the Makefile.
Fossil Repository:

Now, get source (in tar.gz and zip formats) and more!

Use this FOSSIL repo link: Access the Fossil Repository

Example Web Site:
As an example, this web site is included in the source tarball.
Command Line Options:
After it's compiled, "make install" will put the multiplex binary in a run path directory (by default /usr/local/bin). The sample web site can be accessed by running the server in the source directory, or optionally, "make deploy" will copy the site files to /usr/local/www, and the server can be started from that directory. The supplied "servcmd" script is a simple tool to run the server.
Edit "servcmd" to make sure user and group ids are set properly. Similarly, check the .multiplexrc configuration file, particularly the uid/gid settings. Setting "workers" to 2 is usually optimum, but it can be set higher, e.g., to the number of cpu cores if more than 2 are present.
You should then be able to start the server with "./servcmd", at a shell prompt, e.g., in an X terminal. Note that under X, "servcmd" calls the "termx" wrapper for xterm. If xterm is not installed you need to install it or modify "termx" to use the terminal emulator present on your system. Problems starting the server are usually due to incorrect directory or file permissions.
For the browser to connect to the server running on the same host, it's necessary to set a line in /etc/hosts:

Once everything is set, this page should appear in your browser when pointed at your locally running virtual host. If you're having trouble, check uid/gid, directory and file permissions, local DNS setup, as these are the most frequent sources of difficulty.
License: BSD (See LICENSE file in source directory.)
Thanks for your interest in our web server project.
Last updated: Fri Mar 06 2015 04:32:48 +0000