From 8895e3b32a96421598558264919d37fab8ecc781 Mon Sep 17 00:00:00 2001 From: interp Date: Tue, 28 Jan 2003 21:58:33 +0000 Subject: [PATCH] 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' --- scheme/httpd/surflets/start-surflet-server | 41 ++++++++++++++-------- start-extended-web-server | 34 +++++++++++------- start-web-server | 22 +++++++----- 3 files changed, 60 insertions(+), 37 deletions(-) diff --git a/scheme/httpd/surflets/start-surflet-server b/scheme/httpd/surflets/start-surflet-server index bd29113..3e625bf 100755 --- a/scheme/httpd/surflets/start-surflet-server +++ b/scheme/httpd/surflets/start-surflet-server @@ -173,18 +173,20 @@ exec scsh -lm $sunet/packages.scm -lm $ssax/lib/packages.scm -lm $sunet/httpd/su log-file-name simultaneous-requests) - (httpd (with-port port - (with-root-directory (cwd) - (with-simultaneous-requests simultaneous-requests - (with-syslog? #t - (with-logfile log-file-name - ;; The following settings are made to avoid dns lookups. - (with-reported-port port - (with-fqdn "localhost" - (with-resolve-ips? #f - (with-request-handler + (httpd (make-httpd-options + with-port port + with-root-directory (cwd) + with-simultaneous-requests simultaneous-requests + with-syslog? #t + with-logfile log-file-name + ;; The following settings are made to avoid dns lookups. + with-reported-port port + with-fqdn "localhost" + with-resolve-ips? #f + with-request-handler (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 "man" (rman-handler #f "man?%s(%s)" ; "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 ;; not want to write a handler just for this file ;; type.) - (cons "source" (rooted-file-or-directory-handler surflet-dir)) - (cons "img" (rooted-file-handler images-dir)) + (cons "source" (rooted-file-or-directory-handler + 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))) - (rooted-file-or-directory-handler htdocs-dir))))))))))) - )) + (rooted-file-or-directory-handler htdocs-dir + (make-file-directory-options))))) + ) )) ;; EOF diff --git a/start-extended-web-server b/start-extended-web-server index 186fc74..cd34d7f 100755 --- a/start-extended-web-server +++ b/start-extended-web-server @@ -9,10 +9,10 @@ exec scsh -lm packages.scm -dm -o http-test -e main -s "$0" "$@" httpd-make-options httpd-basic-handlers httpd-file-directory-handlers - cgi-server - seval-handler - rman-gateway - info-gateway + httpd-cgi-handlers + httpd-seval-handlers + httpd-rman-gateway + httpd-info-gateway let-opt scsh scheme) @@ -133,21 +133,29 @@ exec scsh -lm packages.scm -dm -o http-test -e main -s "$0" "$@" log-file-name simultaneous-requests) - (httpd (with-port port - (with-root-directory (cwd) - (with-simultaneous-requests simultaneous-requests - (with-syslog? #t - (with-logfile log-file-name - (with-request-handler + (httpd (make-httpd-options + with-port port + with-root-directory (cwd) + with-simultaneous-requests simultaneous-requests + with-syslog? #t + with-logfile log-file-name + with-request-handler (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 "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")) (cons "info" (info-handler #f #f #f "Generated by info-gateway")) (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 diff --git a/start-web-server b/start-web-server index 4843ae1..8473596 100755 --- a/start-web-server +++ b/start-web-server @@ -117,15 +117,19 @@ exec scsh -lm packages.scm -dm -o http-test -e main -s "$0" "$@" port log-file-name) - (httpd (with-port port - (with-root-directory (cwd) - (with-syslog? #t - (with-logfile log-file-name - (with-request-handler - (tilde-home-dir-handler "public_html" - (alist-path-dispatcher - (list (cons "cgi-bin" (cgi-handler cgi-bin-dir))) - (rooted-file-or-directory-handler htdocs-dir)))))))))) + (httpd (make-httpd-options + with-port port + with-root-directory (cwd) + with-syslog? #t + with-logfile log-file-name + with-request-handler + (alist-path-dispatcher + (list (cons "cgi-bin" (cgi-handler cgi-bin-dir))) + (tilde-home-dir-handler "public_html" + (rooted-file-or-directory-handler + htdocs-dir + (make-file-directory-options)) + (make-file-directory-options)))))) )) ;; EOF