mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
fix AWS get_object_http(s)_url methods to properly use subdomain vs path urls as appropriate
closes #611
This commit is contained in:
parent
a61fa4bb04
commit
e2e3f3998b
3 changed files with 15 additions and 5 deletions
|
@ -11,11 +11,16 @@ module Fog
|
|||
unless object_name
|
||||
raise ArgumentError.new('object_name is required')
|
||||
end
|
||||
host, path = if bucket_name =~ /^(?:[a-z]|\d(?!\d{0,2}(?:\.\d{1,3}){3}$))(?:[a-z0-9]|\.(?![\.\-])|\-(?![\.])){1,61}[a-z0-9]$/
|
||||
["#{bucket_name}.s3.amazonaws.com", object_name]
|
||||
else
|
||||
['s3.amazonaws.com', "#{bucket_name}/#{object_name}"]
|
||||
end
|
||||
http_url({
|
||||
:headers => {},
|
||||
:host => @host,
|
||||
:host => host,
|
||||
:method => 'GET',
|
||||
:path => "#{bucket_name}/#{object_name}",
|
||||
:path => path,
|
||||
:query => options[:query]
|
||||
}, expires)
|
||||
end
|
||||
|
|
|
@ -11,11 +11,16 @@ module Fog
|
|||
unless object_name
|
||||
raise ArgumentError.new('object_name is required')
|
||||
end
|
||||
host, path = if bucket_name =~ /^(?:[a-z]|\d(?!\d{0,2}(?:\.\d{1,3}){3}$))(?:[a-z0-9]|\-(?![\.])){1,61}[a-z0-9]$/
|
||||
["#{bucket_name}.s3.amazonaws.com", object_name]
|
||||
else
|
||||
['s3.amazonaws.com', "#{bucket_name}/#{object_name}"]
|
||||
end
|
||||
https_url({
|
||||
:headers => {},
|
||||
:host => @host,
|
||||
:host => host,
|
||||
:method => 'GET',
|
||||
:path => "#{bucket_name}/#{object_name}",
|
||||
:path => path,
|
||||
:query => options[:query]
|
||||
}, expires)
|
||||
end
|
||||
|
|
|
@ -98,7 +98,7 @@ module Fog
|
|||
query << "AWSAccessKeyId=#{@aws_access_key_id}"
|
||||
query << "Signature=#{Fog::AWS.escape(signature(params))}"
|
||||
query << "Expires=#{params[:headers]['Date']}"
|
||||
"#{@host}/#{params[:path]}?#{query.join('&')}"
|
||||
"#{params[:host]}/#{params[:path]}?#{query.join('&')}"
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue