Permalink
Browse files

Update to properly URL encode the signature once it has been calculated.

  • Loading branch information...
1 parent ee0e592 commit 5f979a63fe05b70105abf6cd21a262acedec5dcb @jagthedrummer jagthedrummer committed Dec 22, 2010
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/scalr/request.rb
View
@@ -86,7 +86,7 @@ def process!
set_signature!
http = Net::HTTP.new(@endpoint, 443)
http.use_ssl = true
- response, data = http.get("/?" + query_string + "&Signature=#{URI.escape(@signature)}", nil)
+ response, data = http.get("/?" + query_string + "&Signature=#{@signature}", nil)
return Scalr::Response.new(response, data)
end
@@ -113,7 +113,7 @@ def set_signature!
string_to_sign = query_string.gsub('=','').gsub('&','')
hmac = HMAC::SHA256.new(@access_key)
hmac.update(string_to_sign)
- @signature = Base64.encode64(hmac.digest).chomp
+ @signature = URI.escape(Base64.encode64(hmac.digest).chomp, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]"))
end
end

0 comments on commit 5f979a6

Please sign in to comment.