Use location of script to find web-server root

This commit is contained in:
mainzelm 2004-02-03 14:11:26 +00:00
parent 0a7ada489d
commit 2b27ee6569
3 changed files with 112 additions and 106 deletions

View File

@ -43,11 +43,11 @@ exec scsh -lel sunet-2.1/load.scm -dm -o http-test -e main -s "$0" "$@"
(define simultaneous-requests #f) (define simultaneous-requests #f)
(define (init) (define (init)
(set! htdocs-dir "web-server/root/htdocs") (set! htdocs-dir "root/htdocs")
(set! cgi-bin-dir "web-server/root/cgi-bin") (set! cgi-bin-dir "root/cgi-bin")
(set! port "8080") (set! port "8080")
(set! log-file-name "web-server/httpd.log") (set! log-file-name "httpd.log")
(set! root "web-server/root") (set! root "root")
(set! simultaneous-requests "5")) (set! simultaneous-requests "5"))
(define get-options (define get-options
@ -112,6 +112,8 @@ exec scsh -lel sunet-2.1/load.scm -dm -o http-test -e main -s "$0" "$@"
(define (main args) (define (main args)
(with-cwd
(file-name-directory (car (command-line)))
(init) (init)
(format #t "reading options: ~s~%" (cdr args)) (format #t "reading options: ~s~%" (cdr args))
(get-options (cdr args)) (get-options (cdr args))
@ -153,7 +155,7 @@ exec scsh -lel sunet-2.1/load.scm -dm -o http-test -e main -s "$0" "$@"
(cons "info" (info-handler #f #f #f (cons "info" (info-handler #f #f #f
"Generated by info-gateway")) "Generated by info-gateway"))
(cons "cgi-bin" (cgi-handler cgi-bin-dir))) (cons "cgi-bin" (cgi-handler cgi-bin-dir)))
(rooted-file-or-directory-handler htdocs-dir))))) (rooted-file-or-directory-handler htdocs-dir))))))
)) ))
;; EOF ;; EOF

View File

@ -53,13 +53,13 @@ exec scsh -lel sunet-2.1/load.scm -lel ssax/load.scm -dm -o surflet-server -e ma
(define simultaneous-requests #f) (define simultaneous-requests #f)
(define (init) (define (init)
(set! htdocs-dir "./web-server/root/htdocs") (set! htdocs-dir "root/htdocs")
(set! images-dir "./web-server/root/img") (set! images-dir "root/img")
; (set! cgi-bin-dir "./web-server/root/cgi-bin") ; (set! cgi-bin-dir "./web-server/root/cgi-bin")
(set! port "8008") (set! port "8008")
(set! log-file-name "./web-server/httpd.log") (set! log-file-name "httpd.log")
(set! root "./web-server/root") (set! root "root")
(set! surflet-dir "./web-server/root/surflets") (set! surflet-dir "root/surflets")
(set! simultaneous-requests "5")) (set! simultaneous-requests "5"))
(define (normalize-options) (define (normalize-options)
@ -144,6 +144,8 @@ exec scsh -lel sunet-2.1/load.scm -lel ssax/load.scm -dm -o surflet-server -e ma
(main '(main)))) (main '(main))))
(define (main args) (define (main args)
(with-cwd
(file-name-directory (car (command-line)))
(init) (init)
(format #t "reading options: ~s~%" (cdr args)) (format #t "reading options: ~s~%" (cdr args))
(get-options (cdr args)) (get-options (cdr args))
@ -200,7 +202,7 @@ exec scsh -lel sunet-2.1/load.scm -lel ssax/load.scm -dm -o surflet-server -e ma
(cons "surflet" (surflet-handler (cons "surflet" (surflet-handler
(with-surflet-path surflet-dir)))) (with-surflet-path surflet-dir))))
(rooted-file-or-directory-handler htdocs-dir)))) (rooted-file-or-directory-handler htdocs-dir))))
) ))
)) ))
;; EOF ;; EOF

View File

@ -37,11 +37,11 @@ exec scsh -lel sunet-2.1/load.scm -dm -o http-test -e main -s "$0" "$@"
(define root #f) (define root #f)
(define (init) (define (init)
(set! htdocs-dir "web-server/root/htdocs") (set! htdocs-dir "root/htdocs")
(set! cgi-bin-dir "web-server/root/cgi-bin") (set! cgi-bin-dir "root/cgi-bin")
(set! port "8080") (set! port "8080")
(set! log-file-name "web-server/httpd.log") (set! log-file-name "httpd.log")
(set! root "web-server/root")) (set! root "root"))
(define get-options (define get-options
(let* ((unknown-option-error (let* ((unknown-option-error
@ -103,6 +103,8 @@ exec scsh -lel sunet-2.1/load.scm -dm -o http-test -e main -s "$0" "$@"
(set-uid (->uid "nobody"))))) (set-uid (->uid "nobody")))))
(define (main args) (define (main args)
(with-cwd
(file-name-directory (car (command-line)))
(init) (init)
(format #t "reading options: ~s~%" (cdr args)) (format #t "reading options: ~s~%" (cdr args))
(get-options (cdr args)) (get-options (cdr args))
@ -131,7 +133,7 @@ exec scsh -lel sunet-2.1/load.scm -dm -o http-test -e main -s "$0" "$@"
(cons "seval" seval-handler)) (cons "seval" seval-handler))
(tilde-home-dir-handler "public_html" (tilde-home-dir-handler "public_html"
(rooted-file-or-directory-handler (rooted-file-or-directory-handler
htdocs-dir)))))) htdocs-dir)))))))
)) ))
;; EOF ;; EOF