2002-08-22 11:33:37 -04:00
|
|
|
#!/bin/sh
|
|
|
|
IFS=" "
|
|
|
|
exec scsh -lm ../packages.scm -dm -o http-top -e top -s "$0" "$@"
|
2000-09-26 10:35:26 -04:00
|
|
|
!#
|
|
|
|
|
|
|
|
;;; Scheme Underground Web Server -*- Scheme -*-
|
|
|
|
;;; Olin Shivers
|
|
|
|
|
|
|
|
;;; To compile as a heap-image:
|
|
|
|
;;; ,open http-top
|
|
|
|
;;; (dump-scsh-program top "server")
|
|
|
|
;;; then insert a #! trigger.
|
|
|
|
|
|
|
|
(define-structure http-top (export top)
|
|
|
|
(open httpd-core
|
2002-04-25 04:10:38 -04:00
|
|
|
httpd-make-options
|
2002-11-29 09:42:02 -05:00
|
|
|
httpd-cgi-server
|
2000-09-26 10:35:26 -04:00
|
|
|
httpd-basic-handlers
|
2002-11-29 09:42:02 -05:00
|
|
|
httpd-seval-handlers
|
|
|
|
scheme-with-scsh)
|
2000-09-26 10:35:26 -04:00
|
|
|
(begin
|
|
|
|
|
2002-09-22 11:41:41 -04:00
|
|
|
;; Kitchen-sink request handler.
|
2000-09-26 10:35:26 -04:00
|
|
|
|
2002-09-22 11:41:41 -04:00
|
|
|
(define rh
|
2000-09-26 10:35:26 -04:00
|
|
|
(alist-path-dispatcher
|
2003-01-29 05:08:25 -05:00
|
|
|
`(("h" . ,(home-dir-handler "public_html"))
|
2000-09-26 10:35:26 -04:00
|
|
|
("seval" . ,seval-handler)
|
|
|
|
("cgi-bin" . ,(cgi-handler "/usr/local/etc/httpd/cgi-bin")))
|
2002-08-27 05:45:05 -04:00
|
|
|
(tilde-home-dir-handler "public_html"
|
2003-01-29 05:08:25 -05:00
|
|
|
(rooted-file-handler "/usr/local/etc/httpd/htdocs"))))
|
2000-09-26 10:35:26 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
2003-01-28 10:16:20 -05:00
|
|
|
;; crank up a server on port 8001, first resetting our identity to
|
2000-09-26 10:35:26 -04:00
|
|
|
;; user "nobody". Initialise the request-invariant part of the CGI
|
|
|
|
;; env before starting.
|
|
|
|
|
|
|
|
(define (top args)
|
|
|
|
(display "We be jammin, now.\n") (force-output)
|
|
|
|
(cond ((zero? (user-uid))
|
2002-09-05 04:55:58 -04:00
|
|
|
(set-gid (->gid "nobody"))
|
|
|
|
(set-uid (->uid "nobody"))))
|
2002-05-12 12:04:11 -04:00
|
|
|
;; invariant environment is know initilialized by cgi-handler itself
|
|
|
|
;; (initialise-request-invariant-cgi-env)
|
2002-09-22 11:41:41 -04:00
|
|
|
(httpd (with-request-handler
|
|
|
|
rh
|
2002-04-25 04:10:38 -04:00
|
|
|
(with-port
|
|
|
|
8001
|
2002-08-22 11:33:37 -04:00
|
|
|
(with-root-directory "/usr/local/etc/httpd")))))))
|