re-commit revision 1.22, this time to branch http-1-1
This commit is contained in:
parent
e4a887d491
commit
f96d93b355
|
@ -5,6 +5,10 @@
|
||||||
(let ((surflets? (get-option-value 'with-surflets)))
|
(let ((surflets? (get-option-value 'with-surflets)))
|
||||||
(install-directory-contents "scheme" 'scheme)
|
(install-directory-contents "scheme" 'scheme)
|
||||||
(install-directory "web-server" 'misc-shared)
|
(install-directory "web-server" 'misc-shared)
|
||||||
|
(install-file "start-web-server" 'misc-shared "web-server")
|
||||||
|
(install-file "start-extended-web-server" 'misc-shared "web-server")
|
||||||
|
(if surflets?
|
||||||
|
(install-file "start-surflet-server" 'misc-shared "web-server"))
|
||||||
(install-directory-contents "doc" 'doc)
|
(install-directory-contents "doc" 'doc)
|
||||||
|
|
||||||
(let ((doc-dir (get-directory 'doc #t))
|
(let ((doc-dir (get-directory 'doc #t))
|
||||||
|
|
|
@ -66,36 +66,56 @@
|
||||||
(number status-code-number)
|
(number status-code-number)
|
||||||
(message status-code-message)
|
(message status-code-message)
|
||||||
(
|
(
|
||||||
|
(continue 100 "Continue")
|
||||||
|
(switch-protocol 101 "Switching Protocols")
|
||||||
|
|
||||||
(ok 200 "OK")
|
(ok 200 "OK")
|
||||||
(created 201 "Created")
|
(created 201 "Created")
|
||||||
(accepted 202 "Accepted")
|
(accepted 202 "Accepted")
|
||||||
(prov-info 203 "Provisional Information")
|
(non-author-info 203 "Non-Authoritative Information")
|
||||||
(no-content 204 "No Content")
|
(no-content 204 "No Content")
|
||||||
|
(reset-content 205 "Reset Content")
|
||||||
|
(partial-content 206 "Partial Content")
|
||||||
|
|
||||||
(mult-choice 300 "Multiple Choices")
|
(mult-choice 300 "Multiple Choices")
|
||||||
(moved-perm 301 "Moved Permanently")
|
(moved-perm 301 "Moved Permanently")
|
||||||
(moved-temp 302 "Moved Temporarily")
|
(found 302 "Found");;use 303 or 307 for unambiguity;
|
||||||
(method 303 "Method (obsolete)")
|
;;use 302 for compatibility with
|
||||||
|
;;pre-1.1-clients
|
||||||
|
(see-other 303 "See other");;client is expected to
|
||||||
|
;;perform a GET on new URI
|
||||||
(not-mod 304 "Not Modified")
|
(not-mod 304 "Not Modified")
|
||||||
|
(use-proxy 305 "Use Proxy")
|
||||||
|
(temp-redirect 307 "Temporary Redirect");;analogous to "302
|
||||||
|
;;Moved Temporarily"
|
||||||
|
;;in RFC1945
|
||||||
|
|
||||||
(bad-request 400 "Bad Request")
|
(bad-request 400 "Bad Request")
|
||||||
(unauthorized 401 "Unauthorized")
|
(unauthorized 401 "Unauthorized")
|
||||||
(payment-req 402 "Payment Required")
|
(payment-required 402 "Payment Required")
|
||||||
(forbidden 403 "Forbidden")
|
(forbidden 403 "Forbidden")
|
||||||
(not-found 404 "Not Found")
|
(not-found 404 "Not Found")
|
||||||
(method-not-allowed 405 "Method Not Allowed")
|
(method-not-allowed 405 "Method Not Allowed")
|
||||||
(none-acceptable 406 "None Acceptable")
|
(not-acceptable 406 "Not Acceptable")
|
||||||
(proxy-auth-required 407 "Proxy Authentication Required")
|
(proxy-auth-required 407 "Proxy Authentication Required")
|
||||||
(timeout 408 "Request Timeout")
|
(timeout 408 "Request Timeout")
|
||||||
(conflict 409 "Conflict")
|
(conflict 409 "Conflict")
|
||||||
(gone 410 "Gone")
|
(gone 410 "Gone")
|
||||||
|
(length-required 411 "Length Required")
|
||||||
|
(precon-failed 412 "Precondition Failed")
|
||||||
|
(req-ent-too-large 413 "Request Entity Too Large")
|
||||||
|
(req-uri-too-large 414 "Request URI Too Large")
|
||||||
|
(unsupp-media-type 415 "Unsupported Media Type")
|
||||||
|
(req-range-not-sat 416 "Requested Range Not Satisfiable")
|
||||||
|
(expectation-failed 417 "Expectation Failed")
|
||||||
|
|
||||||
(internal-error 500 "Internal Server Error")
|
(internal-error 500 "Internal Server Error")
|
||||||
(not-implemented 501 "Not Implemented")
|
(not-implemented 501 "Not Implemented")
|
||||||
(bad-gateway 502 "Bad Gateway")
|
(bad-gateway 502 "Bad Gateway")
|
||||||
(service-unavailable 503 "Service Unavailable")
|
(service-unavailable 503 "Service Unavailable")
|
||||||
(gateway-timeout 504 "Gateway Timeout")
|
(gateway-timeout 504 "Gateway Timeout")
|
||||||
|
(version-not-supp 505 "HTTP Version Not Supported")
|
||||||
|
|
||||||
(redirect -301 "Internal redirect")))
|
(redirect -301 "Internal redirect")))
|
||||||
|
|
||||||
(define (name->status-code name)
|
(define (name->status-code name)
|
||||||
|
|
|
@ -111,11 +111,6 @@ exec scsh -lel SSAX-4.9/load.scm -lel sunet-2.1/load.scm -dm -o http-test -e mai
|
||||||
(else
|
(else
|
||||||
(error "Internal error, option not found" option alist))))
|
(error "Internal error, option not found" option alist))))
|
||||||
|
|
||||||
(define (become-nobody-if-root)
|
|
||||||
(cond ((zero? (user-uid))
|
|
||||||
(set-gid (->gid "nobody"))
|
|
||||||
(set-uid (->uid "nobody")))))
|
|
||||||
|
|
||||||
(define (main args)
|
(define (main args)
|
||||||
(with-cwd
|
(with-cwd
|
||||||
(file-name-directory (car args))
|
(file-name-directory (car args))
|
||||||
|
@ -126,6 +121,9 @@ exec scsh -lel SSAX-4.9/load.scm -lel sunet-2.1/load.scm -dm -o http-test -e mai
|
||||||
(log-file-name . "/tmp/httpd.log")
|
(log-file-name . "/tmp/httpd.log")
|
||||||
(requests . 5)))
|
(requests . 5)))
|
||||||
(options (make-options-from-args (cdr args) default-options)))
|
(options (make-options-from-args (cdr args) default-options)))
|
||||||
|
(cond ((zero? (user-uid))
|
||||||
|
(set-gid (->gid "nobody"))
|
||||||
|
(set-uid (->uid "nobody"))))
|
||||||
|
|
||||||
(format #t "Going to run Webserver with:
|
(format #t "Going to run Webserver with:
|
||||||
htdocs-dir: ~a
|
htdocs-dir: ~a
|
||||||
|
@ -147,15 +145,15 @@ exec scsh -lel SSAX-4.9/load.scm -lel sunet-2.1/load.scm -dm -o http-test -e mai
|
||||||
with-simultaneous-requests (lookup-option options 'requests)
|
with-simultaneous-requests (lookup-option options 'requests)
|
||||||
with-syslog? #t
|
with-syslog? #t
|
||||||
with-log-file (lookup-option options 'log-file-name)
|
with-log-file (lookup-option options 'log-file-name)
|
||||||
with-post-bind-thunk become-nobody-if-root
|
|
||||||
with-request-handler
|
with-request-handler
|
||||||
(alist-path-dispatcher
|
(alist-path-dispatcher
|
||||||
(list (cons "seval" seval-handler)
|
(list (cons "h" (home-dir-handler "public_html"))
|
||||||
|
(cons "seval" seval-handler)
|
||||||
;; You may want to adapt this to your site.
|
;; You may want to adapt this to your site.
|
||||||
;; call like http://localhost:8080/man/man?ssh(1)
|
;; call like http://localhost:8080/man/man?ssh(1)
|
||||||
(cons "man" (rman-handler 'man
|
(cons "man" (rman-handler 'man
|
||||||
'nroff
|
'nroff
|
||||||
"/usr/X11R6/bin/rman"
|
"/usr/bin/rman"
|
||||||
"/usr/bin/zcat"
|
"/usr/bin/zcat"
|
||||||
#f "man?%s(%s)"
|
#f "man?%s(%s)"
|
||||||
"Generated by rman-gateway"))
|
"Generated by rman-gateway"))
|
||||||
|
@ -165,9 +163,8 @@ exec scsh -lel SSAX-4.9/load.scm -lel sunet-2.1/load.scm -dm -o http-test -e mai
|
||||||
"Generated by info-gateway"))
|
"Generated by info-gateway"))
|
||||||
(cons "cgi-bin" (cgi-handler
|
(cons "cgi-bin" (cgi-handler
|
||||||
(lookup-option options 'cgi-bin-dir))))
|
(lookup-option options 'cgi-bin-dir))))
|
||||||
(tilde-home-dir-handler "public_html"
|
(rooted-file-or-directory-handler
|
||||||
(rooted-file-or-directory-handler
|
(lookup-option options 'htdocs-dir))))))))
|
||||||
(lookup-option options htdocs-dir)))))))))
|
|
||||||
))
|
))
|
||||||
|
|
||||||
;; EOF
|
;; EOF
|
|
@ -11,8 +11,10 @@ exec scsh -lel SSAX-4.9/load.scm -lel sunet-2.1/load.scm -dm -o surflet-server -
|
||||||
httpd-make-options
|
httpd-make-options
|
||||||
httpd-basic-handlers
|
httpd-basic-handlers
|
||||||
httpd-file-directory-handlers
|
httpd-file-directory-handlers
|
||||||
httpd-cgi-handlers
|
; cgi-server
|
||||||
httpd-seval-handlers
|
; seval-handler
|
||||||
|
; rman-gateway
|
||||||
|
; info-gateway
|
||||||
surflet-handler
|
surflet-handler
|
||||||
surflet-handler/options
|
surflet-handler/options
|
||||||
let-opt
|
let-opt
|
||||||
|
@ -27,7 +29,6 @@ exec scsh -lel SSAX-4.9/load.scm -lel sunet-2.1/load.scm -dm -o surflet-server -
|
||||||
(format #f
|
(format #f
|
||||||
"Usage: start-surflet-server
|
"Usage: start-surflet-server
|
||||||
[-h DIR | --htdocs-dir=DIR] [-s DIR | --surflet-dir=DIR]
|
[-h DIR | --htdocs-dir=DIR] [-s DIR | --surflet-dir=DIR]
|
||||||
[--cgi-bin-dir=DIR]
|
|
||||||
[-i DIR | --images-dir=DIR] [-p NUM | --port=NUM]
|
[-i DIR | --images-dir=DIR] [-p NUM | --port=NUM]
|
||||||
[-l FILE | --log-file-name=FILE] [-r NUM | --requests=NUM]
|
[-l FILE | --log-file-name=FILE] [-r NUM | --requests=NUM]
|
||||||
[--help]
|
[--help]
|
||||||
|
@ -35,14 +36,14 @@ exec scsh -lel SSAX-4.9/load.scm -lel sunet-2.1/load.scm -dm -o surflet-server -
|
||||||
with
|
with
|
||||||
htdocs-dir directory of html files (default: root/htdocs)
|
htdocs-dir directory of html files (default: root/htdocs)
|
||||||
surflet-dir directory of SUrflet files (default: root/surflets)
|
surflet-dir directory of SUrflet files (default: root/surflets)
|
||||||
cgi-bin-dir directory of cgi files (default: root/cgi-bin)
|
|
||||||
images-dir directory of images files (default: root/img)
|
images-dir directory of images files (default: root/img)
|
||||||
port port server is listening to (default: 8080)
|
port port server is listening to (default: 8008)
|
||||||
log-file-name directory where to store the logfile in CLF
|
log-file-name directory where to store the logfile in CLF
|
||||||
(default: /tmp/httpd.log)
|
(default: /tmp/httpd.log)
|
||||||
requests maximal amount of simultaneous requests (default 5)
|
requests maximal amount of simultaneous requests (default 5)
|
||||||
--help show this help
|
--help show this help
|
||||||
"))
|
|
||||||
|
NOTE: This is the SUrflet-server. It does not support cgi-bin.~%"))
|
||||||
|
|
||||||
(define (display-usage)
|
(define (display-usage)
|
||||||
(display (usage) (current-error-port))
|
(display (usage) (current-error-port))
|
||||||
|
@ -82,9 +83,6 @@ exec scsh -lel SSAX-4.9/load.scm -lel sunet-2.1/load.scm -dm -o surflet-server -
|
||||||
(surflet-dir-option
|
(surflet-dir-option
|
||||||
(option '(#\s "surflet-dir") #t #f
|
(option '(#\s "surflet-dir") #t #f
|
||||||
(absolute-file-option-proc 'surflet-dir)))
|
(absolute-file-option-proc 'surflet-dir)))
|
||||||
(cgi-bin-dir-option
|
|
||||||
(option '(#\c "cgi-bin-dir") #t #f
|
|
||||||
(absolute-file-option-proc 'cgi-bin-dir)))
|
|
||||||
(images-dir-option
|
(images-dir-option
|
||||||
(option '(#\i "images-dir") #t #f
|
(option '(#\i "images-dir") #t #f
|
||||||
(absolute-file-option-proc 'images-dir)))
|
(absolute-file-option-proc 'images-dir)))
|
||||||
|
@ -103,7 +101,6 @@ exec scsh -lel SSAX-4.9/load.scm -lel sunet-2.1/load.scm -dm -o surflet-server -
|
||||||
(display-usage)))))
|
(display-usage)))))
|
||||||
(args-fold arg-list
|
(args-fold arg-list
|
||||||
(list htdocs-dir-option surflet-dir-option
|
(list htdocs-dir-option surflet-dir-option
|
||||||
cgi-bin-dir-option
|
|
||||||
images-dir-option port-option
|
images-dir-option port-option
|
||||||
log-file-name-option requests-option
|
log-file-name-option requests-option
|
||||||
help-option)
|
help-option)
|
||||||
|
@ -131,38 +128,34 @@ exec scsh -lel SSAX-4.9/load.scm -lel sunet-2.1/load.scm -dm -o surflet-server -
|
||||||
(main `(main ,@(car args)))
|
(main `(main ,@(car args)))
|
||||||
(main '(main))))
|
(main '(main))))
|
||||||
|
|
||||||
(define (become-nobody-if-root)
|
|
||||||
(cond ((zero? (user-uid))
|
|
||||||
(set-gid (->gid "nobody"))
|
|
||||||
(set-uid (->uid "nobody")))))
|
|
||||||
|
|
||||||
(define (main args)
|
(define (main args)
|
||||||
(with-cwd
|
(with-cwd
|
||||||
(file-name-directory (car args))
|
(file-name-directory (car args))
|
||||||
(let* ((default-options
|
(let* ((default-options
|
||||||
`((htdocs-dir . ,(absolute-file-name "root/htdocs"))
|
`((htdocs-dir . ,(absolute-file-name "root/htdocs"))
|
||||||
(surflet-dir . ,(absolute-file-name "root/surflets"))
|
(surflet-dir . ,(absolute-file-name "root/surflets"))
|
||||||
(cgi-bin-dir . ,(absolute-file-name "root/cgi-bin"))
|
|
||||||
(images-dir . ,(absolute-file-name "root/img"))
|
(images-dir . ,(absolute-file-name "root/img"))
|
||||||
(port . 8080)
|
(port . 8008)
|
||||||
(log-file-name . "/tmp/httpd.log")
|
(log-file-name . "/tmp/httpd.log")
|
||||||
(requests . 5)))
|
(requests . 5)))
|
||||||
(options (make-options-from-args (cdr args) default-options)))
|
(options (make-options-from-args (cdr args) default-options)))
|
||||||
|
(cond ((zero? (user-uid))
|
||||||
|
(set-gid (->gid "nobody"))
|
||||||
|
(set-uid (->uid "nobody"))))
|
||||||
|
|
||||||
(format #t "Going to run SUrflet server with:
|
(format #t "Going to run SUrflet server with:
|
||||||
htdocs-dir: ~a
|
htdocs-dir: ~a
|
||||||
surflet-dir: ~a
|
surflet-dir: ~a
|
||||||
cgi-bin-dir: ~a
|
|
||||||
images-dir: ~a
|
images-dir: ~a
|
||||||
port: ~a
|
port: ~a
|
||||||
log-file-name: ~a
|
log-file-name: ~a
|
||||||
a maximum of ~a simultaneous requests, syslogging activated,
|
a maximum of ~a simultaneous requests, syslogging activated,
|
||||||
and home-dir-handler (public_html) activated.
|
and home-dir-handler (public_html) activated.
|
||||||
|
|
||||||
|
NOTE: This is the SUrflet server. It does not support cgi.
|
||||||
"
|
"
|
||||||
(lookup-option options 'htdocs-dir)
|
(lookup-option options 'htdocs-dir)
|
||||||
(lookup-option options 'surflet-dir)
|
(lookup-option options 'surflet-dir)
|
||||||
(lookup-option options 'cgi-bin-dir)
|
|
||||||
(lookup-option options 'images-dir)
|
(lookup-option options 'images-dir)
|
||||||
(lookup-option options 'port)
|
(lookup-option options 'port)
|
||||||
(lookup-option options 'log-file-name)
|
(lookup-option options 'log-file-name)
|
||||||
|
@ -175,7 +168,6 @@ exec scsh -lel SSAX-4.9/load.scm -lel sunet-2.1/load.scm -dm -o surflet-server -
|
||||||
with-simultaneous-requests (lookup-option options 'requests)
|
with-simultaneous-requests (lookup-option options 'requests)
|
||||||
with-syslog? #t
|
with-syslog? #t
|
||||||
with-log-file (lookup-option options 'log-file-name)
|
with-log-file (lookup-option options 'log-file-name)
|
||||||
with-post-bind-thunk become-nobody-if-root
|
|
||||||
;; The following settings are made to avoid dns lookups.
|
;; The following settings are made to avoid dns lookups.
|
||||||
with-reported-port (lookup-option options 'port)
|
with-reported-port (lookup-option options 'port)
|
||||||
with-fqdn "localhost"
|
with-fqdn "localhost"
|
||||||
|
@ -183,8 +175,7 @@ exec scsh -lel SSAX-4.9/load.scm -lel sunet-2.1/load.scm -dm -o surflet-server -
|
||||||
with-request-handler
|
with-request-handler
|
||||||
(alist-path-dispatcher
|
(alist-path-dispatcher
|
||||||
(list
|
(list
|
||||||
(cons "cgi-bin" (cgi-handler (lookup-option options 'cgi-bin-dir)))
|
(cons "h" (home-dir-handler "public_html"))
|
||||||
(cons "seval" seval-handler)
|
|
||||||
(cons "source" (rooted-file-or-directory-handler
|
(cons "source" (rooted-file-or-directory-handler
|
||||||
(lookup-option options 'surflet-dir)
|
(lookup-option options 'surflet-dir)
|
||||||
(with-file-name->content-type
|
(with-file-name->content-type
|
||||||
|
@ -198,9 +189,8 @@ exec scsh -lel SSAX-4.9/load.scm -lel sunet-2.1/load.scm -dm -o surflet-server -
|
||||||
(cons "surflet" (surflet-handler
|
(cons "surflet" (surflet-handler
|
||||||
(with-surflet-path
|
(with-surflet-path
|
||||||
(lookup-option options 'surflet-dir)))))
|
(lookup-option options 'surflet-dir)))))
|
||||||
(tilde-home-dir-handler "public_html"
|
(rooted-file-or-directory-handler
|
||||||
(rooted-file-or-directory-handler
|
(lookup-option options 'htdocs-dir))))))))
|
||||||
(lookup-option options 'htdocs-dir)))))))))
|
|
||||||
))
|
))
|
||||||
;; EOF
|
;; EOF
|
||||||
|
|
|
@ -9,24 +9,19 @@
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="/sunet-manual/index.html">SUnet release manual</a></li>
|
<li><a href="/sunet-manual/index.html">SUnet release manual</a></li>
|
||||||
<li><a href="/cgi-bin/comments.sh">A small CGI script</a></li>
|
<li><a href="/cgi-bin/comments.sh">A small CGI script</a></li>
|
||||||
<li><a href="/index-surflet.html">SUrflets homepage</a>
|
<li><a href="/index-surflet.html">SUrflets homepage</a></li>
|
||||||
(<code>start-surflet-server</code> only)</li>
|
|
||||||
<li><a href="seval.html">Computing Scheme Forms
|
<li><a href="seval.html">Computing Scheme Forms
|
||||||
Interactively</a></li>
|
Interactively</a></li>
|
||||||
<li><a href="files/text.txt">Text file</a></li>
|
<li><a href="files/text.txt">Text file</a></li>
|
||||||
<li><a href="files">Directory</a></li>
|
<li><a href="files">Directory</a></li>
|
||||||
<li><a href="files/zipped.gz">Compressed File</a></li>
|
<li><a href="files/zipped.gz">Compressed File</a></li>
|
||||||
<li><a href="index.html">This file</a></li>
|
<li><a href="index.html">This file</a></li>
|
||||||
<li><a href="man/man?man(1)">man ls</a>
|
|
||||||
(<code>start-extended-web-server</code> only)</li>
|
|
||||||
<li><a href="info/info?(info.info)Top">Info page for Info</a>
|
|
||||||
(<code>start-extended-web-server</code> only)</li></li>
|
|
||||||
</ul>
|
</ul>
|
||||||
<br>
|
<br>
|
||||||
<hr>
|
<hr>
|
||||||
<!-- Created: Thu Aug 22 16:44:16 CEST 2002 -->
|
<!-- Created: Thu Aug 22 16:44:16 CEST 2002 -->
|
||||||
<!-- hhmts start -->
|
<!-- hhmts start -->
|
||||||
Last modified: Mon May 17 10:13:07 MST 2004
|
Last modified: Wed Apr 23 09:25:58 MST 2003
|
||||||
<!-- hhmts end -->
|
<!-- hhmts end -->
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in New Issue