X-Git-Url: http://git.cielonegro.org/gitweb.cgi?a=blobdiff_plain;f=Network%2FHTTP%2FLucu%2FStaticFile.hs;h=ffda4cf8dbbbc0a6f0bb41b9536dfb30ec2d2d1c;hb=4e41b11;hp=4f669314aee7e599703e999433a63713fe1b4a6f;hpb=ece223c516e66223ef1d5d8e6bbe4054a235d983;p=Lucu.git diff --git a/Network/HTTP/Lucu/StaticFile.hs b/Network/HTTP/Lucu/StaticFile.hs index 4f66931..ffda4cf 100644 --- a/Network/HTTP/Lucu/StaticFile.hs +++ b/Network/HTTP/Lucu/StaticFile.hs @@ -1,6 +1,7 @@ {-# LANGUAGE DoAndIfThenElse , OverloadedStrings + , QuasiQuotes , UnicodeSyntax #-} -- | Handling static files on the filesystem. @@ -27,8 +28,9 @@ import Data.Time.Clock.POSIX import Network.HTTP.Lucu.Abortion import Network.HTTP.Lucu.Config import Network.HTTP.Lucu.ETag -import Network.HTTP.Lucu.MIMEType +import Network.HTTP.Lucu.MIMEType hiding (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 @@ -46,8 +48,7 @@ staticFile path } octetStream ∷ MIMEType -{-# NOINLINE octetStream #-} -octetStream = parseMIMEType "application/octet-stream" +octetStream = [mimeType| application/octet-stream |] handleStaticFile ∷ Bool → FilePath → Resource () handleStaticFile sendContent path @@ -65,6 +66,7 @@ handleStaticFile sendContent path $ abort $ mkAbortion Forbidden [] Nothing + -- FIXME: Forget about ETags of a static file. tag ← liftIO $ generateETagFromFile path let lastMod = posixSecondsToUTCTime $ fromRational