S3: Allow configuring with requeststyle=path to use path-style bucket access instead of the default DNS-style access.

untested
This commit is contained in:
Joey Hess 2016-02-09 15:36:31 -04:00
parent c256fa20f1
commit 5d05aad74c
Failed to extract signature
4 changed files with 23 additions and 1 deletions

View file

@ -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)

2
debian/changelog vendored
View file

@ -26,6 +26,8 @@ git-annex (6.20160127) UNRELEASED; urgency=medium
some servers. Thanks, wzhd.
* WebDAV: Remove a bogus trailing slash from the end of the url to the
temporary store location for a key. Thanks, wzhd.
* S3: Allow configuring with requeststyle=path to use path-style bucket
access instead of the default DNS-style access.
-- Joey Hess <id@joeyh.name> Thu, 28 Jan 2016 13:53:09 -0400

View file

@ -59,6 +59,9 @@ the S3 remote.
* `host` and `port` - Specify in order to use a different, S3 compatable
service.
* `requeststyle` - Set to "path" to use path style requests, instead of the
default DNS style requests. This is needed with some S3 services.
* `bucket` - S3 requires that buckets have a globally unique name,
so by default, a bucket name is chosen based on the remote name
and UUID. This can be specified to pick a bucket name.

View file

@ -0,0 +1,10 @@
[[!comment format=mdwn
username="joey"
subject="""comment 1"""
date="2016-02-09T19:35:10Z"
content="""
Sure, I've added that as requeststyle=path. I have not tested it, so once
you get an updated build let me know if it works.
(Should be available in the daily linux autobuilds within about an hour.)
"""]]