aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2020-07-09 19:40:49 +0530
committerArun Isaac2020-07-10 19:01:31 +0530
commite97b910c70d175f30d082861555571f044c323cc (patch)
tree9b6f60359b6a39c143a29b401f523aac1b17de90
parent3a8697ef5f08dd5166bb26bfa1a4777cf69c06ff (diff)
downloadennum-e97b910c70d175f30d082861555571f044c323cc.tar.gz
ennum-e97b910c70d175f30d082861555571f044c323cc.tar.lz
ennum-e97b910c70d175f30d082861555571f044c323cc.zip
Add comments to ennu-server-start.
* ennu.el (ennu-server-start): Add comments.
-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))