THttpd: http://www.acme.com/software/thttpd/

This document provides some tips about thttpd installation for speedycgi.

The latest thttpd is thttpd-2.23beta1.tar.gz (2003/06/10)

tar -zxvf thttpd-2.23beta1.tar.gz
cd thttpd-2.23beta1

To make thttpd work with openwebmail and speedycgi, you have to apply
the following patch first, or you may see incomplete result page.
---------------------------------------------------------------------
--- libhttpd.c.orig	Tue Jun 10 10:20:22 2003
+++ libhttpd.c	Tue Jun 10 10:21:42 2003
@@ -4169,7 +4169,8 @@
 	    }
 	else if ( r == 0 )
 	    break;
-	nread += r;
+	else
+	    nread += r;
 	}

     return nread;
@@ -4195,7 +4196,8 @@
 		return r;
 	else if ( r == 0 )
 	    break;
-	nwritten += r;
+	else
+	    nwritten += r;
 	}

     return nwritten;
---------------------------------------------------------------------

./configure
make
make install > install.log

And here is an example of the thttpd.conf, you may put in /usr/local/etc
---------------------------------------------------------------------
#host=0.0.0.0
port=80
user=www
#
#
dir=/usr/local/www
cgipat=/cgi-bin/**
#nocgipat
#
#
#charset=iso-8859-1
charset=big5
logfile=/var/log/thttpd.log
pidfile=/var/run/thttpd.pid
#
#
symlink
#nosumlink
#chroot
nochroot
#vhost
novhost
#globalpasswd
noglobalpasswd
#throttles=/usr/local/etc/thttpd.throttle.conf
#max-age=60
---------------------------------------------------------------------

The startup script thttpd.sh
---------------------------------------------------------------------
#!/bin/sh
cd /usr/local/www
/usr/local/sbin/thttpd -C /usr/local/etc/thttpd.conf
echo 'thttpd '
---------------------------------------------------------------------

Note:

While apache has document root and cgi-bin root under same parent directory,
The cgi-bin root must be under the document root in thttpd!

In above example, the document root (option dir) is set to /usr/local/www, and
the cgi-bin root is set as a pattern under /usr/local/www/cgi-bin/ (option cgipat)

So in your openwebmail.conf, you will need set the following options:

ow_cgidir               /usr/local/www/cgi-bin/openwebmail
ow_cgiurl               /cgi-bin/openwebmail
ow_htmldir              /usr/local/www/data/openwebmail
ow_htmlurl              /data/openwebmail

For more information please refer to the man page of thttpd.

06/10/2003

openwebmail.AT.turtle.ee.ncku.edu.tw
