fix s3 to play nice with eu zone

This commit is contained in:
Wesley Beary 2009-07-22 19:28:53 -07:00
parent da0d4b79b2
commit e31174d189
3 changed files with 13 additions and 5 deletions

View File

@ -105,9 +105,8 @@ DATA
string_to_sign << "#{canonical_amz_headers}"
canonical_resource = "/"
# [0..-18] is anything prior to .s3.amazonaws.com
subdomain = params[:host][0..-18]
unless subdomain.empty?
subdomain = params[:host].split(".#{@host}").first
unless subdomain == @host
canonical_resource << "#{subdomain}/"
end
canonical_resource << "#{params[:path]}"

View File

@ -1,13 +1,13 @@
require File.dirname(__FILE__) + '/../../spec_helper'
describe 'S3.get_location' do
describe 'S3.get_bucket_location' do
before(:all) do
s3.put_bucket('foggetlocation', :location_constraint => 'EU')
end
after(:all) do
s3.delete_bucket('foggetlocation')
eu_s3.delete_bucket('foggetlocation')
end
it 'should return proper attributes' do

View File

@ -38,6 +38,15 @@ def s3
)
end
end
def eu_s3
@eu_s3 ||= begin
Fog::AWS::S3.new(
:aws_access_key_id => credentials['aws_access_key_id'],
:aws_secret_access_key => credentials['aws_secret_access_key'],
:host => 's3-external-3.amazonaws.com'
)
end
end
def eventually(&block)
[0,2,4,8,16].each do |delay|