on master help sign in
Merge pull request #358 from DeathByTape/get-head
0838caaMichael Snoyman
wai-app-static/Network/Wai/Application/Static.hs+2−2
@@ -214,10 +214,10 @@ staticApp set req = staticAppPieces set (W.pathInfo req) req
214
214
215staticAppPieces :: StaticSettings -> [Text] -> W.Application
215staticAppPieces :: StaticSettings -> [Text] -> W.Application
216staticAppPieces _ _ req sendResponse
216staticAppPieces _ _ req sendResponse
217− | W.requestMethod req /= "GET" = sendResponse $ W.responseLBS
217+ | notElem (W.requestMethod req) ["GET", "HEAD"] = sendResponse $ W.responseLBS
218 H.status405
218 H.status405
219 [("Content-Type", "text/plain")]
219 [("Content-Type", "text/plain")]
220− "Only GET is supported"
220+ "Only GET or HEAD is supported"
221staticAppPieces _ [".hidden", "folder.png"] _ sendResponse = sendResponse $ W.responseLBS H.status200 [("Content-Type", "image/png")] $ L.fromChunks [$(embedFile "images/folder.png")]
221staticAppPieces _ [".hidden", "folder.png"] _ sendResponse = sendResponse $ W.responseLBS H.status200 [("Content-Type", "image/png")] $ L.fromChunks [$(embedFile "images/folder.png")]
222staticAppPieces _ [".hidden", "haskell.png"] _ sendResponse = sendResponse $ W.responseLBS H.status200 [("Content-Type", "image/png")] $ L.fromChunks [$(embedFile "images/haskell.png")]
222staticAppPieces _ [".hidden", "haskell.png"] _ sendResponse = sendResponse $ W.responseLBS H.status200 [("Content-Type", "image/png")] $ L.fromChunks [$(embedFile "images/haskell.png")]
223staticAppPieces ss rawPieces req sendResponse = liftIO $ do
223staticAppPieces ss rawPieces req sendResponse = liftIO $ do
wai-app-static/WaiAppStatic/CmdLine.hs−2
@@ -14,7 +14,6 @@ import Options.Applicative
14import Text.Printf (printf)
14import Text.Printf (printf)
15import System.Directory (canonicalizePath)
15import System.Directory (canonicalizePath)
16import Control.Monad (unless)
16import Control.Monad (unless)
17−import Network.Wai.Middleware.Autohead
18import Network.Wai.Middleware.RequestLogger (logStdout)
17import Network.Wai.Middleware.RequestLogger (logStdout)
19import Network.Wai.Middleware.Gzip
18import Network.Wai.Middleware.Gzip
20import qualified Data.Map as Map
19import qualified Data.Map as Map
@@ -100,7 +99,6 @@ runCommandLine middleware = do
100 unless quiet $ printf "Serving directory %s on port %d with %s index files.\n" docroot' port (if noindex then "no" else show index)
99 unless quiet $ printf "Serving directory %s on port %d with %s index files.\n" docroot' port (if noindex then "no" else show index)
101 let middle = gzip def { gzipFiles = GzipCompress }
100 let middle = gzip def { gzipFiles = GzipCompress }
102 . (if verbose then logStdout else id)
101 . (if verbose then logStdout else id)
103− . autohead
104 . (middleware args)
102 . (middleware args)
105 runSettings defaultSettings
103 runSettings defaultSettings
106 { settingsPort = port
104 { settingsPort = port