WebDAV: Avoid buffering whole file in memory when downloading.

httpBodyRetriever will later also be used by S3

This commit was sponsored by Ethan Aubin.
This commit is contained in:
Joey Hess 2014-08-08 13:40:55 -04:00
parent fc17cf852e
commit c3f8512475
4 changed files with 37 additions and 23 deletions

View file

@ -29,8 +29,8 @@ inLocation :: (MonadIO m) => DavLocation -> DAVT m a -> DAVT m a
inLocation d = inDAVLocation (</> d)
{- The directory where files(s) for a key are stored. -}
keyLocation :: Key -> DavLocation
keyLocation k = addTrailingPathSeparator $ hashdir </> keyFile k
keyDir :: Key -> DavLocation
keyDir k = addTrailingPathSeparator $ hashdir </> keyFile k
where
#ifndef mingw32_HOST_OS
hashdir = hashDirLower k
@ -38,6 +38,9 @@ keyLocation k = addTrailingPathSeparator $ hashdir </> keyFile k
hashdir = replace "\\" "/" (hashDirLower k)
#endif
keyLocation :: Key -> DavLocation
keyLocation k = keyDir k ++ keyFile k
{- Where we store temporary data for a key as it's being uploaded. -}
keyTmpLocation :: Key -> DavLocation
keyTmpLocation = addTrailingPathSeparator . tmpLocation . keyFile