summaryrefslogtreecommitdiff
path: root/Remote
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-02-09 15:36:31 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-02-09 15:36:36 -0400
commite82eb195e48c095a064d2e59b5b0cee69328230a (patch)
treed9bad79cb564e25a7e108d75bfe8f7bfc2f248e2 /Remote
parentf5fc7f83e42fc245bfbd198c6e54d26a7a8e8024 (diff)
S3: Allow configuring with requeststyle=path to use path-style bucket access instead of the default DNS-style access.
untested
Diffstat (limited to 'Remote')
-rw-r--r--Remote/S3.hs9
1 files changed, 8 insertions, 1 deletions
diff --git a/Remote/S3.hs b/Remote/S3.hs
index 961f621fb..d1c6dd3df 100644
--- a/Remote/S3.hs
+++ b/Remote/S3.hs
@@ -431,7 +431,13 @@ withS3HandleMaybe c u a = do
{ managerResponseTimeout = Nothing }
s3Configuration :: RemoteConfig -> S3.S3Configuration AWS.NormalQuery
-s3Configuration c = (S3.s3 proto endpoint False) { S3.s3Port = port }
+s3Configuration c = cfg
+ { S3.s3Port = port
+ , S3.s3RequestStyle = case M.lookup "requeststyle" c of
+ Just "path" -> S3.PathStyle
+ Just s -> error $ "bad S3 requeststyle value: " ++ s
+ Nothing -> S3.s3RequestStyle cfg
+ }
where
proto
| port == 443 = AWS.HTTPS
@@ -448,6 +454,7 @@ s3Configuration c = (S3.s3 proto endpoint False) { S3.s3Port = port }
case reads s of
[(p, _)] -> p
_ -> error $ "bad S3 port value: " ++ s
+ cfg = S3.s3 proto endpoint False
tryS3 :: Annex a -> Annex (Either S3.S3Error a)
tryS3 a = (Right <$> a) `catch` (pure . Left)