Adapt to recent interface changes of HTTPD and its file handlers.

Particularly, the SUrflet server can now serve the source of SUrflets
via '/source/add-raw.scm'
This commit is contained in:
interp 2003-01-28 21:58:33 +00:00
parent 367caeb01d
commit 8895e3b32a
3 changed files with 60 additions and 37 deletions

View File

@ -173,18 +173,20 @@ exec scsh -lm $sunet/packages.scm -lm $ssax/lib/packages.scm -lm $sunet/httpd/su
log-file-name log-file-name
simultaneous-requests) simultaneous-requests)
(httpd (with-port port (httpd (make-httpd-options
(with-root-directory (cwd) with-port port
(with-simultaneous-requests simultaneous-requests with-root-directory (cwd)
(with-syslog? #t with-simultaneous-requests simultaneous-requests
(with-logfile log-file-name with-syslog? #t
;; The following settings are made to avoid dns lookups. with-logfile log-file-name
(with-reported-port port ;; The following settings are made to avoid dns lookups.
(with-fqdn "localhost" with-reported-port port
(with-resolve-ips? #f with-fqdn "localhost"
(with-request-handler with-resolve-ips? #f
with-request-handler
(alist-path-dispatcher (alist-path-dispatcher
(list (cons "h" (home-dir-handler "public_html")) (list (cons "h" (home-dir-handler "public_html"
(make-file-directory-options)))
; (cons "seval" seval-handler) ; (cons "seval" seval-handler)
; (cons "man" (rman-handler #f "man?%s(%s)" ; (cons "man" (rman-handler #f "man?%s(%s)"
; "Generated by rman-gateway")) ; "Generated by rman-gateway"))
@ -197,11 +199,20 @@ exec scsh -lm $sunet/packages.scm -lm $ssax/lib/packages.scm -lm $sunet/httpd/su
;; should serve .SCM files as text/plain (I did ;; should serve .SCM files as text/plain (I did
;; not want to write a handler just for this file ;; not want to write a handler just for this file
;; type.) ;; type.)
(cons "source" (rooted-file-or-directory-handler surflet-dir)) (cons "source" (rooted-file-or-directory-handler
(cons "img" (rooted-file-handler images-dir)) surflet-dir
(with-file-name->content-type
(lambda (file-name)
(if (string-ci=? (file-name-extension file-name)
".scm")
"text/plain"))
(make-file-directory-options))))
(cons "img" (rooted-file-handler images-dir
(make-file-directory-options)))
(cons "surflet" (surflet-handler surflet-dir))) (cons "surflet" (surflet-handler surflet-dir)))
(rooted-file-or-directory-handler htdocs-dir))))))))))) (rooted-file-or-directory-handler htdocs-dir
)) (make-file-directory-options)))))
)
)) ))
;; EOF ;; EOF

View File

@ -9,10 +9,10 @@ exec scsh -lm packages.scm -dm -o http-test -e main -s "$0" "$@"
httpd-make-options httpd-make-options
httpd-basic-handlers httpd-basic-handlers
httpd-file-directory-handlers httpd-file-directory-handlers
cgi-server httpd-cgi-handlers
seval-handler httpd-seval-handlers
rman-gateway httpd-rman-gateway
info-gateway httpd-info-gateway
let-opt let-opt
scsh scsh
scheme) scheme)
@ -133,21 +133,29 @@ exec scsh -lm packages.scm -dm -o http-test -e main -s "$0" "$@"
log-file-name log-file-name
simultaneous-requests) simultaneous-requests)
(httpd (with-port port (httpd (make-httpd-options
(with-root-directory (cwd) with-port port
(with-simultaneous-requests simultaneous-requests with-root-directory (cwd)
(with-syslog? #t with-simultaneous-requests simultaneous-requests
(with-logfile log-file-name with-syslog? #t
(with-request-handler with-logfile log-file-name
with-request-handler
(alist-path-dispatcher (alist-path-dispatcher
(list (cons "h" (home-dir-handler "public_html")) (list (cons "h" (home-dir-handler "public_html"
(make-file-directory-options)))
(cons "seval" seval-handler) (cons "seval" seval-handler)
(cons "man" (rman-handler #f "man?%s(%s)" ;; You may want to adapt this to your site.
(cons "man" (rman-handler 'man
'nroff
"/usr/bin/rman"
"/usr/bin/zcat"
#f "man?%s(%s)"
"Generated by rman-gateway")) "Generated by rman-gateway"))
(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
(make-file-directory-options))))))
)) ))
;; EOF ;; EOF

View File

@ -117,15 +117,19 @@ exec scsh -lm packages.scm -dm -o http-test -e main -s "$0" "$@"
port port
log-file-name) log-file-name)
(httpd (with-port port (httpd (make-httpd-options
(with-root-directory (cwd) with-port port
(with-syslog? #t with-root-directory (cwd)
(with-logfile log-file-name with-syslog? #t
(with-request-handler with-logfile log-file-name
(tilde-home-dir-handler "public_html" with-request-handler
(alist-path-dispatcher (alist-path-dispatcher
(list (cons "cgi-bin" (cgi-handler cgi-bin-dir))) (list (cons "cgi-bin" (cgi-handler cgi-bin-dir)))
(rooted-file-or-directory-handler htdocs-dir)))))))))) (tilde-home-dir-handler "public_html"
(rooted-file-or-directory-handler
htdocs-dir
(make-file-directory-options))
(make-file-directory-options))))))
)) ))
;; EOF ;; EOF