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

[aws][storage] more robust object url generation, also fixes non-standard regions and defaults to https

This commit is contained in:
geemus 2010-09-24 11:32:48 -07:00
parent a986736523
commit 99d2920372
3 changed files with 10 additions and 9 deletions

View file

@ -23,9 +23,9 @@ module Fog
end
url({
:headers => {},
:host => "#{bucket_name}.#{@host}",
:host => @host,
:method => 'GET',
:path => CGI.escape(object_name)
:path => [bucket_name, CGI.escape(object_name)].join('/')
}, expires)
end
@ -42,9 +42,9 @@ module Fog
end
url({
:headers => {},
:host => "#{bucket_name}.#{@host}",
:host => @host,
:method => 'GET',
:path => CGI.escape(object_name)
:path => [bucket_name, CGI.escape(object_name)].join('/')
}, expires)
end

View file

@ -23,9 +23,9 @@ module Fog
end
url({
:headers => {},
:host => "#{bucket_name}.#{@host}",
:host => @host,
:method => 'PUT',
:path => CGI.escape(object_name)
:path => [bucket_name, CGI.escape(object_name)].join('/')
}, expires)
end
@ -42,9 +42,9 @@ module Fog
end
url({
:headers => {},
:host => "#{bucket_name}.#{@host}",
:host => @host,
:method => 'PUT',
:path => CGI.escape(object_name)
:path => [bucket_name, CGI.escape(object_name)].join('/')
}, expires)
end

View file

@ -64,7 +64,8 @@ module Fog
query << "AWSAccessKeyId=#{@aws_access_key_id}"
query << "Signature=#{CGI.escape(signature(params))}"
query << "Expires=#{params[:headers]['Date']}"
"http://#{params[:host]}/#{params[:path]}?#{query.join('&')}"
bucket = params[:host].split('.').first
"https://#{@host}/#{params[:path]}?#{query.join('&')}"
end
end