X-Git-Url: http://git.cielonegro.org/gitweb.cgi?p=Lucu.git;a=blobdiff_plain;f=Network%2FHTTP%2FLucu%2FStaticFile.hs;fp=Network%2FHTTP%2FLucu%2FStaticFile.hs;h=5ed214aae58dc5b2cea55d78625f1fc7d3b3b4df;hp=5b5eb9734e3a68441516f36a86ada99269ea7888;hb=3baf479eba12bc3e9c4ef966df770cd70aa5cd81;hpb=57b93dc50655857941cc176aed2fc085e6555ff7 diff --git a/Network/HTTP/Lucu/StaticFile.hs b/Network/HTTP/Lucu/StaticFile.hs index 5b5eb97..5ed214a 100644 --- a/Network/HTTP/Lucu/StaticFile.hs +++ b/Network/HTTP/Lucu/StaticFile.hs @@ -15,6 +15,7 @@ import Control.Monad.Unicode import Control.Monad.Trans import Data.ByteString (ByteString) import qualified Data.ByteString.Lazy.Char8 as LBS +import Data.Monoid.Unicode import Data.String import qualified Data.Text as T import qualified Data.Text.Encoding as T @@ -35,7 +36,7 @@ import System.FilePath -- @fpath@ on the filesystem. staticFile ∷ FilePath → Resource staticFile path - = emptyResource { + = (∅) { resGet = Just $ handleStaticFile True path , resHead = Just $ handleStaticFile False path } @@ -71,18 +72,16 @@ handleStaticFile sendContent path $ liftIO (LBS.readFile path) ≫= putChunks -- | @'staticDir' dir@ is a 'Resource' which maps all files in @dir@ --- and its subdirectories on the filesystem to the --- 'Network.HTTP.Lucu.Resource.Tree.ResTree'. +-- and its subdirectories on the filesystem to the resource tree. -- -- Note that 'staticDir' currently doesn't have a directory-listing -- capability. Requesting the content of a directory will end up being -- replied with /403 Forbidden/. staticDir ∷ FilePath → Resource staticDir path - = emptyResource { - resIsGreedy = True - , resGet = Just $ handleStaticDir True path - , resHead = Just $ handleStaticDir False path + = (∅) { + resGet = Just $ handleStaticDir True path + , resHead = Just $ handleStaticDir False path } -- TODO: implement directory listing.