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.)
This commit is contained in:
parent
82a0d614cf
commit
a1355917ec
1 changed files with 1 additions and 1 deletions
|
@ -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))
|
||||
{
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue