Commit d270ba5e authored by Bas Lijnse's avatar Bas Lijnse

Added a configurable "Static" directory in which publicly accessible...

Added a configurable "Static" directory in which publicly accessible information can be placed (e.g. images etc)

git-svn-id: https://svn.cs.ru.nl/repos/iTask-system/trunk@711 63da3aa8-80fd-4f01-9db8-e6ea747a3da2
parent 8e60f6fc
......@@ -6,6 +6,7 @@ definition module Config
:: Config =
{ clientPath :: !String // Where is the client located.
, staticPath :: !String // Additional location where statically served content may be placed
, rootPassword :: !String // Password for the 'root' superuser.
, sessionTime :: !Int // Time (in seconds) before inactive sessions are garbage collected. Default is 3600 (one hour).
, serverPort :: !Int // The TCP port the server runs on. Default is 80.
......
......@@ -8,6 +8,7 @@ derive JSONDecode Config
defaultConfig :: Config
defaultConfig =
{ clientPath = "Client"
, staticPath = "Static"
, rootPassword = ""
, sessionTime = 3600
, serverPort = 80
......
......@@ -67,7 +67,14 @@ handleStaticResourceRequest req world
| ok = ({rsp_headers = [("Status","200 OK"),
("Content-Type", type),
("Content-Length", toString (size content))]
,rsp_data = content}, world)
,rsp_data = content}, world)
# filename = config.staticPath +++ filePath path
# (type, world) = http_staticFileMimeType filename world
# (ok, content, world) = http_staticFileContent filename world
| ok = ({rsp_headers = [("Status","200 OK"),
("Content-Type", type),
("Content-Length", toString (size content))]
,rsp_data = content}, world)
= http_notfoundResponse req world
where
//Translate a URL path to a filesystem path
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment