1
0
Fork 0
mirror of https://github.com/fog/fog-aws.git synced 2022-11-09 13:50:52 -05:00

Add support for cname buckets

This commit is contained in:
Duarte Henriques 2015-02-24 19:39:57 +00:00
parent cba35fb5be
commit ba6a4cb454

View file

@ -256,21 +256,25 @@ module Fog
if params[:bucket_name] if params[:bucket_name]
bucket_name = params[:bucket_name] bucket_name = params[:bucket_name]
path_style = params.fetch(:path_style, @path_style) if params[:bucket_cname]
if !path_style host = bucket_name
if COMPLIANT_BUCKET_NAMES !~ bucket_name
Fog::Logger.warning("fog: the specified s3 bucket name(#{bucket_name}) is not a valid dns name, which will negatively impact performance. For details see: http://docs.amazonwebservices.com/AmazonS3/latest/dev/BucketRestrictions.html")
path_style = true
elsif scheme == 'https' && !path_style && bucket_name =~ /\./
Fog::Logger.warning("fog: the specified s3 bucket name(#{bucket_name}) contains a '.' so is not accessible over https as a virtual hosted bucket, which will negatively impact performance. For details see: http://docs.amazonwebservices.com/AmazonS3/latest/dev/BucketRestrictions.html")
path_style = true
end
end
if path_style
path = bucket_to_path bucket_name, path
else else
host = [bucket_name, host].join('.') path_style = params.fetch(:path_style, @path_style)
if !path_style
if COMPLIANT_BUCKET_NAMES !~ bucket_name
Fog::Logger.warning("fog: the specified s3 bucket name(#{bucket_name}) is not a valid dns name, which will negatively impact performance. For details see: http://docs.amazonwebservices.com/AmazonS3/latest/dev/BucketRestrictions.html")
path_style = true
elsif scheme == 'https' && !path_style && bucket_name =~ /\./
Fog::Logger.warning("fog: the specified s3 bucket name(#{bucket_name}) contains a '.' so is not accessible over https as a virtual hosted bucket, which will negatively impact performance. For details see: http://docs.amazonwebservices.com/AmazonS3/latest/dev/BucketRestrictions.html")
path_style = true
end
end
if path_style
path = bucket_to_path bucket_name, path
else
host = [bucket_name, host].join('.')
end
end end
end end