* load $SSAXPATH/lib/packages.scm; if SSAXPATH is not defined or null,

"SSAX" is used.

* add command line option for httpd option `max. number of concurrent
  request'
This commit is contained in:
interp 2002-09-19 11:07:37 +00:00
parent ec23e5dbb6
commit e866228288
1 changed files with 14 additions and 7 deletions

View File

@ -1,6 +1,6 @@
#!/bin/sh
echo "Loading..."
exec scsh -lm packages.scm -lm httpd/servlets/packages.scm -dm -o http-test -e main -s "$0" "$@"
exec scsh -lm packages.scm -lm httpd/servlets/packages.scm -lm ${SSAXPATH:-SSAX}/lib/packages.scm -dm -o http-test -e main -s "$0" "$@"
!#
(define-structure http-test
@ -23,7 +23,7 @@ exec scsh -lm packages.scm -lm httpd/servlets/packages.scm -dm -o http-test -e m
(define (usage)
(format #f
"Usage: start-web-server [-h htdocs-dir] [-c cgi-bin-dir] [-p port]
[-l log-file-name] [--help]
[-l log-file-name] [-r requests] [--help]
with
htdocs-dir directory of html files (default: web-server/root/htdocs)
@ -31,6 +31,7 @@ exec scsh -lm packages.scm -lm httpd/servlets/packages.scm -dm -o http-test -e m
port port server is listening to (default: 8080)
log-file-name directory where to store the logfile in CLF
(default: web-server/httpd.log)
requests maximal amount of simultaneous requests (default 5)
--help show this help
"
))
@ -41,6 +42,7 @@ exec scsh -lm packages.scm -lm httpd/servlets/packages.scm -dm -o http-test -e m
(define log-file-name #f)
(define root #f)
(define servlet-dir #f)
(define simultaneous-requests "5")
(define (init)
(set! htdocs-dir "web-server/root/htdocs")
@ -71,7 +73,8 @@ exec scsh -lm packages.scm -lm httpd/servlets/packages.scm -dm -o http-test -e m
(set! log-file-name (absolute-file-name log-file-name))
(set! cgi-bin-dir (absolute-file-name cgi-bin-dir))
(set! port (string->number port))
(set! servlet-dir (absolute-file-name servlet-dir)))
(set! servlet-dir (absolute-file-name servlet-dir))
(set! simultaneous-requests (string->number simultaneous-requests)))
(cond
((string=? (car options) "-h")
(if (null? (cdr options))
@ -98,6 +101,11 @@ exec scsh -lm packages.scm -lm httpd/servlets/packages.scm -dm -o http-test -e m
(missing-argument-error (car options))
(set! servlet-dir (cadr options)))
(loop (cddr options)))
((string=? (car options) "-r")
(if (null? (cdr options))
(missing-argument-error (car options))
(set! simultaneous-requests (cadr options)))
(loop (cddr options)))
((string=? (car options) "--help")
(display (usage))
(exit 0))
@ -113,9 +121,8 @@ exec scsh -lm packages.scm -lm httpd/servlets/packages.scm -dm -o http-test -e m
(define (main args)
(init)
(write args)
(format #t "reading options: ~s~%" (cdr args))
(get-options (cdr args))
(format #t "options read~%")
(cond ((zero? (user-uid))
(set-gid (->gid "nobody"))
(set-uid (->uid "nobody"))))
@ -132,11 +139,11 @@ exec scsh -lm packages.scm -lm httpd/servlets/packages.scm -dm -o http-test -e m
cgi-bin-dir
port
log-file-name
5)
simultaneous-requests)
(httpd (with-port port
; (with-root-directory (absolute-file-name "./web-server/root")
(with-simultaneous-requests 5
(with-simultaneous-requests simultaneous-requests
(with-syslog? #t
(with-logfile log-file-name
(with-path-handler