packages feed

happstack-server 6.0.0 → 6.0.1

raw patch · 2 files changed

+7/−8 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

happstack-server.cabal view
@@ -1,5 +1,5 @@ Name:                happstack-server-Version:             6.0.0+Version:             6.0.1 Synopsis:            Web related tools and services. Description:         Happstack Server provides an HTTP server and a rich set of functions for routing requests, handling query parameters, generating responses, working with cookies, serving files, and more. For in-depth documentation see the Happstack Crash Course <http://happstack.com/docs/crashcourse/index.html> License:             BSD3
src/Happstack/Server/FileServe/BuildingBlocks.hs view
@@ -59,7 +59,7 @@ import Happstack.Server.Types      (Length(ContentLength), Request(rqPaths, rqUri), Response(SendFile), RsFlags(rsfLength), nullRsFlags, result, resultBS, setHeader) import System.Directory (doesDirectoryExist, doesFileExist, getDirectoryContents, getModificationTime) import System.FilePath ((</>), addTrailingPathSeparator, joinPath, takeExtension)-import System.IO (IOMode(ReadMode), hFileSize, hClose, openBinaryFile)+import System.IO (IOMode(ReadMode), hFileSize, hClose, openBinaryFile, withBinaryFile) import System.Locale (defaultTimeLocale, rfc822DateFormat) import System.Log.Logger (Priority(DEBUG), logM) import System.Time (CalendarTime, formatCalendarTime, toCalendarTime, toUTCTime)@@ -216,13 +216,12 @@                  -> FilePath -- ^ path to file on disk                  -> m Response filePathSendFile contentType fp =-    do handle  <- liftIO $ openBinaryFile fp ReadMode -- garbage collection should close this+    do count   <- liftIO $ withBinaryFile fp ReadMode hFileSize -- garbage collection should close this        modtime <- liftIO $ getModificationTime fp-       count   <- liftIO $ hFileSize handle        rq      <- askRq        return $ sendFileResponse contentType fp (Just (toUTCTime modtime, rq)) 0 count --- | Send the specified file with the specified mime-type using Lazy ByteStrings+-- | Send the specified file with the specified mime-type using lazy ByteStrings -- -- NOTE: assumes file exists and is readable by the server. See 'serveFileUsing'. --@@ -232,14 +231,14 @@                  -> FilePath -- ^ path to file on disk                  -> m Response filePathLazy contentType fp =-    do handle  <- liftIO $ openBinaryFile fp ReadMode -- garbage collection should close this+    do handle   <- liftIO $ openBinaryFile fp ReadMode -- garbage collection should close this        contents <- liftIO $ L.hGetContents handle        modtime  <- liftIO $ getModificationTime fp        count    <- liftIO $ hFileSize handle        rq       <- askRq        return $ lazyByteStringResponse contentType contents (Just (toUTCTime modtime, rq)) 0 count --- | Send the specified file with the specified mime-type using Lazy ByteStrings+-- | Send the specified file with the specified mime-type using strict ByteStrings -- -- NOTE: assumes file exists and is readable by the server. See 'serveFileUsing'. --@@ -251,7 +250,7 @@ filePathStrict contentType fp =     do contents <- liftIO $ S.readFile fp        modtime  <- liftIO $ getModificationTime fp-       count    <- liftIO $ bracket (openBinaryFile fp ReadMode) hClose hFileSize+       count    <- liftIO $ withBinaryFile fp ReadMode hFileSize        rq       <- askRq        return $ strictByteStringResponse contentType contents (Just (toUTCTime modtime, rq)) 0 count