awwx.ws

srv-static-subdir-filetypes

(= 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)))))))

Get this hack

hack ycombinator.com/arc/arc3.1.tar \
  awwx.ws/srv-static-subdir-filetypes0.arc

License

This code is derived from Arc, and may be redistributed or modified under the same terms as Arc itself.

Contact me

Twitter: awwx
Email: andrew.wilcox [at] gmail.com