aboutsummaryrefslogtreecommitdiff
path: root/web/webserver.scm
diff options
context:
space:
mode:
Diffstat (limited to 'web/webserver.scm')
-rwxr-xr-xweb/webserver.scm26
1 files changed, 10 insertions, 16 deletions
diff --git a/web/webserver.scm b/web/webserver.scm
index 91ff6d6..d697735 100755
--- a/web/webserver.scm
+++ b/web/webserver.scm
@@ -18,6 +18,7 @@
;; (ice-9 source)
(srfi srfi-1)
(srfi srfi-11) ; let-values
+ (srfi srfi-19) ; time
(srfi srfi-26)
(rnrs io ports) ; bytevector-all
(web http)
@@ -88,22 +89,15 @@ otherwise search for set/group data"
(define (file-extension file-name)
(last (string-split file-name #\.)))
-(define* (render-static-image path #:key (extra-headers '()))
- (list `((content-type
- . ,(assoc-ref file-mime-types
- (file-extension "CMOR.jpg"))) ; (last-modified . ,(time-utc->date modified))
- )
- (call-with-input-file "./static/images/CMOR.jpg" get-bytevector-all)))
-
-#!
-(call-with-input-file "./static/images/CMOR.jpg" get-bytevector-all)
-(list (append extra-headers
- '((content-type . (application/octet-stream)))
- (lambda (port)
- (put-bytevector port
- (call-with-input-file "./static/images/CMOR.jpg" get-bytevector-all)
- )
-!#
+(define* (render-static-image file-name #:key (extra-headers '()))
+ (let* ((stat (stat file-name #f))
+ (modified (and stat
+ (make-time time-utc 0 (stat:mtime stat)))))
+ (list `((content-type . ,(assoc-ref file-mime-types
+ (file-extension file-name)))
+ (last-modified . ,(time-utc->date modified)))
+
+ (call-with-input-file "./static/images/CMOR.jpg" get-bytevector-all))))
(define* (render-doc path page #:optional rec #:key (extra-headers '()))
(list (append extra-headers