Changeset 12024 in project
- Timestamp:
- 09/28/08 18:44:19 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
release/4/spiffy/trunk/spiffy.scm
r12023 r12024 101 101 (define request-restarter (make-parameter #f)) 102 102 103 ;; A simple utility procedure to render a status code with message 103 104 (define (send-status code reason #!optional text) 104 105 (parameterize ((current-response (update-response (current-response) … … 124 125 125 126 (define (send-static-file filename) 126 (with-headers `((content-length ,(file-size filename))) 127 (lambda () 128 (write-response (current-response)) 129 (let ([fd (file-open filename (+ open/binary open/rdonly))]) 130 (handle-exceptions exn (begin 131 (file-close fd) 132 (signal exn)) 133 (sendfile fd (response-port (current-response)))) 134 (file-close fd))))) 127 (let ((path (make-pathname (root-path) filename))) 128 (with-headers `((content-length ,(file-size path))) 129 (lambda () 130 (write-response (current-response)) 131 (let ([fd (file-open path (+ open/binary open/rdonly))]) 132 (handle-exceptions exn (begin 133 (file-close fd) 134 (signal exn)) 135 (sendfile fd (response-port (current-response)))) 136 (file-close fd)))))) 135 137 136 138 (define (extension->mime-type ext) … … 176 178 (cdr remaining-path))))) 177 179 ((file-exists? path) 178 ((handle-file) path))180 ((handle-file) current-path)) 179 181 (else ((handle-not-found)))))) 180 182
Note: See TracChangeset
for help on using the changeset viewer.