aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ennu.el6
1 files changed, 6 insertions, 0 deletions
diff --git a/ennu.el b/ennu.el
index c19799f..d7f6cca 100644
--- a/ennu.el
+++ b/ennu.el
@@ -501,11 +501,17 @@ as keys. Keys are compared using `equal'."
(let ((uri-path (httpd-unhex uri-path))
(file-path (httpd-gen-path uri-path)))
(cond
+ ;; If a HTML file other than index.html was requested, reject
+ ;; that request.
((and (not (string= (file-name-nondirectory file-path) "index.html"))
(string= (file-name-extension file-path) "html"))
(httpd-error proc 404))
+ ;; If the requested file was found, serve it.
((= (httpd-status file-path) 200)
(httpd-serve-root proc httpd-root uri-path request))
+ ;; Perhaps, this is a post or other HTML file that is being
+ ;; requested. Try serving a file with a .html extension
+ ;; appended.
(t (httpd-serve-root proc httpd-root (concat uri-path ".html") request)))))
(httpd-start)
(message "Ennu web server listening at http://localhost:%d" httpd-port))