1 ;;; file-server.el --- serve any files using Emacs Web Server
2 (lexical-let ((docroot default-directory))
5 (with-slots (process headers) request
6 (let ((path (substring (cdr (assoc :GET headers)) 1)))
7 (if (ws-in-directory-p docroot path)
8 (if (file-directory-p path)
9 (ws-send-directory-list process
10 (expand-file-name path docroot) "^[^\.]")
11 (ws-send-file process (expand-file-name path docroot)))
12 (ws-send-404 process)))))