X-Git-Url: http://git.cielonegro.org/gitweb.cgi?a=blobdiff_plain;f=Network%2FHTTP%2FLucu%2FStaticFile.hs;h=5cb8fb0efbd90a8710ff2fc5872528b2e6684400;hb=f093019cb10a88fee13b8c99d05b60f895ceb01f;hp=5ed214aae58dc5b2cea55d78625f1fc7d3b3b4df;hpb=3baf479eba12bc3e9c4ef966df770cd70aa5cd81;p=Lucu.git diff --git a/Network/HTTP/Lucu/StaticFile.hs b/Network/HTTP/Lucu/StaticFile.hs index 5ed214a..5cb8fb0 100644 --- a/Network/HTTP/Lucu/StaticFile.hs +++ b/Network/HTTP/Lucu/StaticFile.hs @@ -15,18 +15,18 @@ import Control.Monad.Unicode import Control.Monad.Trans import Data.ByteString (ByteString) import qualified Data.ByteString.Lazy.Char8 as LBS +import Data.Convertible.Base +import Data.Convertible.Instances.Text () import Data.Monoid.Unicode import Data.String -import qualified Data.Text as T import qualified Data.Text.Encoding as T import Network.HTTP.Lucu.Abortion import Network.HTTP.Lucu.Config -import Network.HTTP.Lucu.MIMEType hiding (mimeType) +import Network.HTTP.Lucu.MIMEType import Network.HTTP.Lucu.MIMEType.Guess -import Network.HTTP.Lucu.MIMEType.TH import Network.HTTP.Lucu.Resource import Network.HTTP.Lucu.Resource.Internal -import Network.HTTP.Lucu.Response +import Network.HTTP.Lucu.Response.StatusCode import Network.HTTP.Lucu.Utils import Prelude.Unicode import System.Directory @@ -72,7 +72,9 @@ 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 resource tree. +-- and its subdirectories on the filesystem to the resource tree. Thus +-- having 'Network.HTTP.Lucu.nonGreedy' 'staticDir' in a tree makes no +-- sense. -- -- Note that 'staticDir' currently doesn't have a directory-listing -- capability. Requesting the content of a directory will end up being @@ -93,7 +95,7 @@ handleStaticDir sendContent basePath handleStaticFile sendContent path where dec8 ∷ ByteString → String - dec8 = T.unpack ∘ T.decodeUtf8 + dec8 = cs ∘ T.decodeUtf8 securityCheck ∷ (Eq s, Show s, IsString s, Monad m) ⇒ [s] → m () securityCheck pathElems