[gambit-list] web server example

Marc Feeley feeley at iro.umontreal.ca
Tue Jan 22 11:42:40 EST 2013


On 2013-01-22, at 11:14 AM, Fred Weigel <fred_weigel at hotmail.com> wrote:

> A sample web server is supplied with Gambit-C. I am using gsi 4.6.6
> 
> [fred at dejah Gambit-C]$ gsi
> Gambit v4.6.6
> 
>> 
> 
> and tried the web server (for inclusion into some of my own code). I do
> like the design, but there seems to be a bug. In http.scm line 827,
> there is a reference to function (print). The problem is that (print)
> doesn't produce ANY output on "port", and the contents are then
> interpreted as a flat text file. I replaced (print) with (display), and
> the thing works (as expected).
> 
> Running on Fedora 17 Linux, with the invocation
> 
> gsi base64 html http web-server 8000
> 
> (as recommended).

Strange that this incorrect call to print went unnoticed for so long...  You can't simply replace the call to print by a call to display.  The correct fix is:

                (print
                 port: port
                 (list version " 200 OK" eol
                       "Content-Length: " (u8vector-length message) eol
                       "Content-Type: text/html; charset=ISO-8859-1" eol
                       "Connection: close" eol
                       eol))

Thanks for reporting the problem!

Marc




More information about the Gambit-list mailing list