diff --git a/start-web-server b/start-web-server new file mode 100755 index 0000000..394f3d9 --- /dev/null +++ b/start-web-server @@ -0,0 +1,44 @@ +#!/bin/sh +echo "Starting scsh..." +exec scsh -lm packages.scm -dm -o http-test -e main -s "$0" "$@" +!# + +(define-structure http-test + (export main) + (open httpd-core + httpd-make-options + httpd-basic-handlers + cgi-server + let-opt + scsh + scheme) + + (begin + + (define (main args) + (let ((port (string->number (:optional (cdr args) "8080")))) + (if port + (begin + (format #t "Web-Server is now running on port ~d...~%" port) + (http port)) + (format #t "Usage: ~a [port]~%~a~%" (car args) args)))) + + (define (http port) + (cond ((zero? (user-uid)) + (set-gid -2) ; Should be (set-uid (->uid "nobody")) + (set-uid -2))) ; but NeXTSTEP loses. + (httpd (with-port port + (with-root-directory (absolute-file-name "./web-server/root") + (with-simultaneous-requests 23 + (with-syslog? #t + (with-logfile (absolute-file-name "./web-server/httpd.log") + (with-path-handler + (alist-path-dispatcher + (list (cons "h" (home-dir-handler "public_html")) + (cons "cgi-bin" + (cgi-handler (absolute-file-name + "./web-server/root/cgi-bin")))) + (rooted-file-or-directory-handler + (absolute-file-name "./web-server/root/htdocs") "")))))))))) +)) +;; EOF