git.iko.soy/typeable/minio-hs
on master help sign in
Support for Yandex Object Storage (#147)
ae141fdAditya Manthramurthy
src/Network/Minio/Sign/V4.hs+3−3
@@ -117,13 +117,15 @@ signV4 !sp !req =
117 accessKey = toS $ spAccessKey sp
117 accessKey = toS $ spAccessKey sp
118 secretKey = toS $ spSecretKey sp
118 secretKey = toS $ spSecretKey sp
119 expiry = spExpirySecs sp
119 expiry = spExpirySecs sp
120+ sha256Hdr = ("x-amz-content-sha256",
121+ fromMaybe "UNSIGNED-PAYLOAD" $ spPayloadHash sp)
120
122
121 -- headers to be added to the request
123 -- headers to be added to the request
122 datePair = ("X-Amz-Date", awsTimeFormatBS ts)
124 datePair = ("X-Amz-Date", awsTimeFormatBS ts)
123 computedHeaders = NC.requestHeaders req ++
125 computedHeaders = NC.requestHeaders req ++
124 if isJust $ expiry
126 if isJust $ expiry
125 then []
127 then []
126− else [(\(x, y) -> (mk x, y)) datePair]
128+ else map (\(x, y) -> (mk x, y)) [datePair, sha256Hdr]
127 headersToSign = getHeadersToSign computedHeaders
129 headersToSign = getHeadersToSign computedHeaders
128 signedHeaderKeys = B.intercalate ";" $ sort $ map fst headersToSign
130 signedHeaderKeys = B.intercalate ";" $ sort $ map fst headersToSign
129
131
@@ -158,8 +160,6 @@ signV4 !sp !req =
158 authHeader = mkAuthHeader (spAccessKey sp) scope signedHeaderKeys signature
160 authHeader = mkAuthHeader (spAccessKey sp) scope signedHeaderKeys signature
159
161
160 -- finally compute output pairs
162 -- finally compute output pairs
161− sha256Hdr = ("x-amz-content-sha256",
162− fromMaybe "UNSIGNED-PAYLOAD" $ spPayloadHash sp)
163 output = if isJust expiry
163 output = if isJust expiry
164 then ("X-Amz-Signature", signature) : authQP
164 then ("X-Amz-Signature", signature) : authQP
165 else [(\(x, y) -> (CI.foldedCase x, y)) authHeader,
165 else [(\(x, y) -> (CI.foldedCase x, y)) authHeader,