hS3 0.5.5 → 0.5.6
raw patch · 4 files changed
+11/−4 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- Network/AWS/Authentication.hs +3/−2
- Network/AWS/S3Object.hs +3/−0
- examples/uploadFile.hs +4/−1
- hS3.cabal +1/−1
Network/AWS/Authentication.hs view
@@ -101,9 +101,10 @@ . s3metadata -- | Inspect HTTP body, and add a @Content-Length@ header with the--- correct length.+-- correct length, if it does not already exist. addContentLengthHeader :: HTTP.HTTPRequest L.ByteString -> HTTP.HTTPRequest L.ByteString-addContentLengthHeader req = insertHeader HdrContentLength (show (L.length (rqBody req))) req+addContentLengthHeader req = insertHeaderIfMissing HdrContentLength conlength req+ where conlength = show (L.length (rqBody req)) -- | Add AWS authentication header to an HTTP request. addAuthenticationHeader :: S3Action -- ^ Action with authentication data
Network/AWS/S3Object.hs view
@@ -26,6 +26,7 @@ import Network.URI import System.Time import Data.List.Utils+import Data.List(lookup) import qualified Data.ByteString.Lazy.Char8 as L @@ -95,6 +96,8 @@ copyObject aws obj (setStorageClass sc (obj {obj_headers = []})) -- | Send data for an object.+-- If the header "Content-Length" is not set, all content must be read into+-- memory prior to sending. sendObject :: AWSConnection -- ^ AWS connection information -> S3Object -- ^ Object to add to a bucket -> IO (AWSResult ()) -- ^ Server response
examples/uploadFile.hs view
@@ -24,13 +24,16 @@ import Data.Maybe import System.IO import qualified Data.ByteString.Lazy.Char8 as L+import System.Posix.Files main = do argv <- getArgs let bucket : key : filename : xs = argv f <- L.readFile filename+ contentFS <- getFileStatus filename+ let offset = fileSize contentFS mConn <- amazonS3ConnectionFromEnv let conn = fromJust mConn- let obj = S3Object bucket key "text/plain" [] f+ let obj = S3Object bucket key "text/plain" [("Content-Length",(show offset))] f res <- sendObject conn obj either (putStrLn . prettyReqError) (const $ putStrLn ("Creation of " ++ key ++ " successful."))
hS3.cabal view
@@ -1,5 +1,5 @@ Name: hS3-Version: 0.5.5+Version: 0.5.6 License: BSD3 License-file: LICENSE Cabal-Version: >= 1.6