about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-06-19T16·40+0200
committerEelco Dolstra <edolstra@gmail.com>2017-06-19T16·51+0200
commita1355917ecf75e1f1f37101505a351743d590121 (patch)
tree4b264aa627842d5d420ee6f7b8fe18b61402494f /src
parent82a0d614cf17b2997ba5f895c1db4c2cde41e88d (diff)
Disable use of virtual hosting in aws-sdk-cpp
Recently aws-sdk-cpp quietly switched to using S3 virtual host URIs
(https://github.com/aws/aws-sdk-cpp/commit/69d9c53882), i.e. it sends
requests to http://<bucket>.<region>.s3.amazonaws.com rather than
http://<region>.s3.amazonaws.com/<bucket>. However this interacts
badly with curl connection reuse. For example, if we do the following:

1) Check whether a bucket exists using GetBucketLocation.
2) If it doesn't, create it using CreateBucket.
3) Do operations on the bucket.

then 3) will fail for a minute or so with a NoSuchBucket exception,
presumably because the server being hit is a fallback for cases when
buckets don't exist.

Disabling the use of virtual hosts ensures that 3) succeeds
immediately. (I don't know what S3's consistency guarantees are for
bucket creation, but in practice buckets appear to be available
immediately.)
Diffstat (limited to 'src')
-rw-r--r--src/libstore/s3-binary-cache-store.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libstore/s3-binary-cache-store.cc b/src/libstore/s3-binary-cache-store.cc
index 06622210cbf4..145a8191c55c 100644
--- a/src/libstore/s3-binary-cache-store.cc
+++ b/src/libstore/s3-binary-cache-store.cc
@@ -79,7 +79,7 @@ static void initAWS()
 
 S3Helper::S3Helper(const string & region)
     : config(makeConfig(region))
-    , client(make_ref<Aws::S3::S3Client>(*config))
+    , client(make_ref<Aws::S3::S3Client>(*config, true, false))
 {
 }