lib/fog/storage/aws.rb in fog-0.9.0 vs lib/fog/storage/aws.rb in fog-0.10.0
- old
+ new
@@ -28,10 +28,12 @@
request :get_bucket_versioning
request :get_bucket_website
request :get_object
request :get_object_acl
request :get_object_torrent
+ request :get_object_http_url
+ request :get_object_https_url
request :get_object_url
request :get_request_payment
request :get_service
request :head_object
request :initiate_multipart_upload
@@ -58,11 +60,26 @@
:aws_access_key_id => @aws_access_key_id,
:aws_secret_access_key => @aws_secret_access_key
)
end
+ def http_url(params, expires)
+ "http://" << host_path_query(params, expires)
+ end
+
+ def https_url(params, expires)
+ "https://" << host_path_query(params, expires)
+ end
+
def url(params, expires)
+ Formatador.display_line("[yellow][WARN] #{Fog::Storage::AWS} => #url is deprecated, use #https_url instead[/] [light_black](#{caller.first})[/]")
+ https_url(params, expires)
+ end
+
+ private
+
+ def host_path_query(params, expires)
params[:headers] ||= {}
params[:headers]['Date'] = expires.to_i
params[:path] = Fog::AWS.escape(params[:path]).gsub('%2F', '/')
query = []
if params[:query]
@@ -71,10 +88,10 @@
end
end
query << "AWSAccessKeyId=#{@aws_access_key_id}"
query << "Signature=#{Fog::AWS.escape(signature(params))}"
query << "Expires=#{params[:headers]['Date']}"
- "https://#{@host}/#{params[:path]}?#{query.join('&')}"
+ "#{@host}/#{params[:path]}?#{query.join('&')}"
end
end
class Mock