Skip to content

Commit

Permalink
Added clean support for AWS Europe
Browse files Browse the repository at this point in the history
  • Loading branch information
Vlad committed Mar 1, 2009
1 parent ac97d47 commit a13504b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/aws/s3/authentication.rb
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def initialize(request, options = {})
# "For non-authenticated or anonymous requests. A NotImplemented error result code will be returned if
# an authenticated (signed) request specifies a Host: header other than 's3.amazonaws.com'"
# (from http://docs.amazonwebservices.com/AmazonS3/2006-03-01/VirtualHosting.html)
request['Host'] = DEFAULT_HOST
request['Host'] = AWS::S3::Base.connection.subdomain || DEFAULT_HOST
build
end

Expand All @@ -173,7 +173,7 @@ def build
self << (key =~ self.class.amazon_header_prefix ? "#{key}:#{value}" : value)
self << "\n"
end
self << path
self << (AWS::S3::Base.connection.subdomain ? "/#{AWS::S3::Base.connection.subdomain}#{path}" : path)
end

def initialize_headers
Expand Down
2 changes: 1 addition & 1 deletion lib/aws/s3/bucket.rb
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def path(name, options = {})
options = name
name = nil
end
"/#{bucket_name(name)}#{RequestOptions.process(options).to_query_string}"
bucket_name(name) == connection.subdomain ? "/#{RequestOptions.process(options).to_query_string}" : "/#{bucket_name(name)}#{RequestOptions.process(options).to_query_string}"
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/aws/s3/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def url_for(path, options = {})
end

def subdomain
http.address[/^([^.]+).#{DEFAULT_HOST}$/, 1]
http.address[/^(.+)\.#{DEFAULT_HOST}$/, 1]
end

def persistent?
Expand Down
2 changes: 1 addition & 1 deletion lib/aws/s3/object.rb
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ def path!(bucket, name, options = {}) #:nodoc:
options.replace(bucket)
bucket = nil
end
'/' << File.join(bucket_name(bucket), name)
bucket_name(bucket) == connection.subdomain ? "/#{name}" : "/#{bucket_name(bucket)}/#{name}"
end

private
Expand Down

0 comments on commit a13504b

Please sign in to comment.