lib/awsbase/right_awsbase.rb in appoxy-aws-1.11.31 vs lib/awsbase/right_awsbase.rb in appoxy-aws-1.11.32
- old
+ new
@@ -23,10 +23,11 @@
# Test
module RightAws
require 'digest/md5'
require 'pp'
+ require 'cgi'
class AwsUtils #:nodoc:
@@digest1 = OpenSSL::Digest::Digest.new("sha1")
@@digest256 = nil
if OpenSSL::OPENSSL_VERSION_NUMBER > 0x00908000
@@ -38,12 +39,13 @@
end
# Escape a string accordingly Amazon rulles
# http://docs.amazonwebservices.com/AmazonSimpleDB/2007-11-07/DeveloperGuide/index.html?REST_RESTAuth.html
def self.amz_escape(param)
- param.to_s.gsub(/([^a-zA-Z0-9._~-]+)/n) do
- '%' + $1.unpack('H2' * $1.size).join('%').upcase
- end
+ return CGI.escape(param).gsub("%7E", "~").gsub("+", "%20") # from: http://umlaut.rubyforge.org/svn/trunk/lib/aws_product_sign.rb
+ #param.to_s.gsub(/([^a-zA-Z0-9._~-]+)/n) do
+ # '%' + $1.unpack('H2' * $1.size).join('%').upcase
+ #end
end
# Set a timestamp and a signature version
def self.fix_service_params(service_hash, signature)
service_hash["Timestamp"] ||= Time.now.utc.strftime("%Y-%m-%dT%H:%M:%S.000Z") unless service_hash["Expires"]