Work on request handler.
This commit is contained in:
parent
4cd4fa3bb1
commit
cd36a88d12
1 changed files with 24 additions and 1 deletions
|
@ -3,11 +3,15 @@
|
|||
texts
|
||||
spiffy
|
||||
openssl
|
||||
(chicken tcp))
|
||||
(chicken tcp)
|
||||
intarweb
|
||||
uri-common)
|
||||
|
||||
(define -port- (make-parameter #f))
|
||||
(define -certificate- (make-parameter #f))
|
||||
(define -key- (make-parameter #f))
|
||||
(define -user- (make-parameter #f))
|
||||
(define -group- (make-parameter #f))
|
||||
|
||||
(command-line
|
||||
print-help
|
||||
|
@ -48,3 +52,22 @@
|
|||
(ssl-listen port)
|
||||
(tcp-listen port)))
|
||||
|
||||
(when (and (-user-) (-group-))
|
||||
(switch-user/group (-user-) (-group-)))
|
||||
|
||||
(handle-not-found
|
||||
(lambda (path)
|
||||
(define path-lst (uri-path (request-uri (current-request))))
|
||||
(print (car path-lst))
|
||||
(define body
|
||||
(cond ((equal? (car path-lst) '/)
|
||||
(print "index")
|
||||
(frontend-lookup "index.html" "index not found"))
|
||||
(else
|
||||
"error")))
|
||||
(send-response #:body body)))
|
||||
|
||||
(accept-loop listener
|
||||
(if ssl?
|
||||
ssl-accept
|
||||
tcp-accept))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue