(= static-filetypes* (listtab:pair:list
"gif" 'gif
"jpg" 'jpg
"jpeg" 'jpg
"png" 'png
"css" 'text/html
"txt" 'text/html
"htm" 'text/html
"html" 'text/html
"arc" 'text/html
))
(def safe-path (path)
(and (~begins path "/")
(~some [in _ "." ".."] (tokens path #\/))))
(def static-filetype (sym)
(let fname (coerce sym 'string)
(and (safe-path fname)
(static-filetypes* (downcase (last (check (tokens fname #\.) ~single)))))))
static-filetypes* where they can be easily modified.hack ycombinator.com/arc/arc3.1.tar \ awwx.ws/srv-static-subdir-filetypes0.arc
This code is derived from Arc, and may be redistributed or modified under the same terms as Arc itself.