@@ -8,6 +8,9 @@ import System.Console.CmdArgs
88import Text.Printf (printf)
99import System.Directory (canonicalizePath)
1010import Control.Monad (unless)
11+import Network.Wai.Middleware.Autohead
12+import Network.Wai.Middleware.Debug
13+import Network.Wai.Middleware.Gzip
1114
1215data Args = Args
1316 { docroot :: FilePath
@@ -15,10 +18,11 @@ data Args = Args
1518 , port :: Int
1619 , noindex :: Bool
1720 , quiet :: Bool
21+ , verbose :: Bool
1822 }
1923 deriving (Show, Data, Typeable)
2024
21−defaultArgs = Args "." ["index.html", "index.htm"] 3000 False False
25+defaultArgs = Args "." ["index.html", "index.htm"] 3000 False False False
2226
2327main :: IO ()
2428main = do
@@ -26,7 +30,10 @@ main = do
2630 docroot' <- canonicalizePath docroot
2731 args <- getArgs
2832 unless quiet $ printf "Serving directory %s on port %d with %s index files.\n" docroot' port (if noindex then "no" else show index)
29− run port $ staticApp StaticSettings
33+ let middle = gzip False
34+ . (if verbose then debug else id)
35+ . autohead
36+ run port $ middle $ staticApp StaticSettings
3037 { ssFolder = docroot
3138 , ssIndices = if noindex then [] else index
3239 , ssListing = Just defaultListing