~ salmonella-environment-setup (master) /awful/awful.conf
Trap1;; -*- scheme -*-
2(import scheme)
3(cond-expand
4 (chicken-4
5 (import chicken)
6 (use awful html-tags html-utils intarweb
7 spiffy spiffy-sexpr-log spiffy-directory-listing))
8 (chicken-5
9 (import (chicken pathname))
10 (import awful html-tags html-utils intarweb
11 spiffy spiffy-sexpr-log spiffy-directory-listing))
12 (else
13 (error "Unsupported CHICKEN version.")))
14
15(root-path "/home/chicken/salmonella/reports")
16(split-log? #t)
17
18(access-log "/var/log/awful")
19(error-log "/var/log/awful/error.log")
20
21(mime-type-map
22 (append
23 (mime-type-map)
24 '(("logz" . text/plain)
25 ("svg" . image/svg+xml)
26 ("svgz" . image/svg+xml)
27 ("htmlz" . text/html))))
28
29(define (send-gzipped-file file)
30 (if (memq 'gzip (header-values 'accept-encoding
31 (request-headers (current-request))))
32 (with-headers '((content-encoding gzip))
33 (lambda ()
34 (send-static-file file)))
35 (send-response
36 code: 406
37 body: "<h1>406 - Only gzip-compressed content is available</h1>")))
38
39(index-files
40 (cons "index.htmlz"
41 (index-files)))
42
43(file-extension-handlers
44 `(("logz" . ,send-gzipped-file)
45 ("svgz" . ,send-gzipped-file)
46 ("htmlz" . ,send-gzipped-file)))
47
48(directory-listing-css "http://wiki.call-cc.org/chicken.css")
49(handle-directory spiffy-directory-listing)
50(directory-listing-page
51 (lambda (path contents)
52 (html-page
53 (<div> id: "content"
54 (<h2> "Index of " (<code> path) ":")
55 (<p> (<a> href: (or (pathname-directory path) path)
56 "Go to parent directory"))
57 contents)
58 css: (directory-listing-css)
59 doctype: (directory-listing-doctype)
60 title: ((directory-listing-title) path))))
61
62;; Redirect requests to .html -> .htmlz. The redirection will only be
63;; performed if the .html file doesn't exist in the filesystem
64(define-page (irregex "/.*\\.html$")
65 (lambda (path)
66 (redirect-to (string-append path "z"))))