Skip to content

amoe/boson

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

README

Boson is a port of the Fermion web server, which was originally written by Vijay Mathew for the Spark Scheme system. This version should be portable to any R6RS-compliant system. It has been tested with the following systems:

  • Mosh (primary development platform)
  • Ikarus (SVN version)
  • Vicare
  • Ypsilon
  • Petite Chez Scheme
  • Guile
  • Larceny
  • IronScheme
  • Racket

Installation

Run 'bootstrap.sh' to create a makefile link.

Boson depends on the following R6RS libraries:

You also need some compat files for mosh.

The test suite additionally depends on the following:

The makefile installs to /usr/local/share/scheme/r6rs by default. The Scheme interepreter is expected to be found at 'scheme-r6rs' in your PATH. All the dependencies are assumed to be already available in your Scheme environment. You can normally ensure this by using an implementation-specific environment variable. Alternatively, if you install these libraries to /usr/local/share/scheme/r6rs, my Mosh packages for Debian come pre-patched with the correct path.

Test suite

The test suite is contained in the file test.scm. It uses the library (sistim wrap64) which is a custom test runner for the SRFI-64 testing API. You can execute the tests using 'make test'.

Running

Run the binary 'boson'. The server will listen on port 8080 by default. It will serve static content by default. Scheme servlets are identified by default with the extension '.ss'.

Here is a very simple servlet::

(library (hello)
  (export start)
  (import (rnrs))

  (define (start req)
    "Hello, world"))

Save to 'hello.ss'.

Goals

As this is the first release, version 1, I am aiming to stay as close to the Fermion source as possible. As far as possible, this functions the same as Fermion, with a few caveats:

  • Most importantly, see the note about concurrency below.
  • The API for Scheme scripts has been incompatibly changed, as R6RS does not define LOAD.
  • I have fixed an egregious path traversal vulnerability in the URL handling code.
  • I have fixed a bug where the content-length and content-type headers were reversed.

I have cleaned up and removed code wherever I can do so without affecting functionality.

In the long run, I plan to diverge significantly from Fermion. Most notably I plan to remove the SML feature and a lot of the static file serving features, so beware of relying on these. I might also remove some homespun functionality and replace it with external libraries.

Possibly check out the ocelotl scheduler?

Caveats

Currently some very notable features are missing.

  1. There is no way to specify a document root for the server.
  2. There is no way to specify an interface for the server to listen on.
  3. There is no capacity for the server to daemonize itself.
  4. There is no way to a servlet to know which method it has been requested with.
  5. The extended session servlet API is broken (two arguments)
  6. You can't throw a procedure to jump to it, instead you must raise a condition of type &session-jump with the procedure's index.
  7. Servlets cannot accept data with the POST method.

Concurrency

TL;DR = Boson is not concurrent.

The original Fermion uses PLT's extremely simple threading API from v371, see [1]. However this code was mainly developed on Mosh, and while Mosh does provide a concurrency API, it requires all shared structures to be declared as nongenerative. This seems quite an invasive change and I am still considering a better way to do it. On the other hand, a blocking server is actually no problem for my needs, so I thought it was worth releasing in any case.

In the future I will probably introduce concurrency using a coroutine pool. (Note that it still won't be real multicore concurrency, but at least it won't be so egregiously blocking.)

Running Boson under daemontools

This is a nice way to run Boson as it means you can reload changes easily with minimal downtime. To do this you can run the install_dt makefile target. This will create a daemontools control directory which is located at /usr/local/etc/daemontools/boson by default, you can modify the makefile or pass a parameter to change the path.

License

As it is a derivative of Spark Scheme, Boson is distributed under the GPLv3. Therefore derived works must also be under the GPL.

Bugs

Please report them to [email protected]. Currently I don't have any kind of bug tracking system to enter them into, sorry about that.

[1] http://download.plt-scheme.org/doc/371/html/mzscheme/mzscheme-Z-H-7.html

About

web server derived from Fermion (circa 2011)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages