http-server example: Resolve access to subfolder
This commit is contained in:
parent
834c78c044
commit
5282755f8e
1 changed files with 5 additions and 2 deletions
|
|
@ -34,7 +34,7 @@
|
|||
(string/join (if attrs? (rest body) body))
|
||||
(name tag))))
|
||||
body (cond
|
||||
(not (.exists f)) ""
|
||||
(not (.exists f)) (str path " not exist")
|
||||
(.isFile f) (slurp f)
|
||||
(.isDirectory f) (format "<!DOCTYPE html>\n%s"
|
||||
(html :html
|
||||
|
|
@ -45,7 +45,10 @@
|
|||
(html :tt
|
||||
(apply html :pre
|
||||
(for [i (.list f)]
|
||||
(html :div (html :a {:href (format "\"%s\"" i)} i)))))))))]
|
||||
(html :div
|
||||
(html :a
|
||||
{:href (str (if (> (count path) 1) path) "/" i)} i)
|
||||
))))))))]
|
||||
(prn path)
|
||||
(.write out (format "HTTP/1.1 %s OK\r\nContent-Length: %s\r\n\r\n%s"
|
||||
status
|
||||
|
|
|
|||
Loading…
Reference in a new issue