qoobaa-aws-sqs 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.4
1
+ 0.1.5
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{aws-sqs}
5
- s.version = "0.1.4"
5
+ s.version = "0.1.5"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Jakub Kuźma"]
@@ -40,10 +40,7 @@ module Aws
40
40
  # Escape a string accordingly Amazon rulles
41
41
  # http://docs.amazonwebservices.com/AmazonSimpleDB/2007-11-07/DeveloperGuide/index.html?REST_RESTAuth.html
42
42
  def self.amz_escape(param)
43
- param.to_s.gsub(/([^a-zA-Z0-9._~-]+)/u) do
44
- size = $1.respond_to?(:bytesize) ? $1.bytesize : $1.size
45
- '%' + $1.unpack('H2' * size).join('%').upcase
46
- end
43
+ URI.escape(param, /([^a-zA-Z0-9._~-]+)/)
47
44
  end
48
45
 
49
46
  # Set a timestamp and a signature version
@@ -53,24 +50,6 @@ module Aws
53
50
  service_hash
54
51
  end
55
52
 
56
- # Signature Version 0
57
- # A deprecated guy (should work till septemper 2009)
58
- def self.sign_request_v0(aws_secret_access_key, service_hash)
59
- fix_service_params(service_hash, '0')
60
- string_to_sign = "#{service_hash['Action']}#{service_hash['Timestamp'] || service_hash['Expires']}"
61
- service_hash['Signature'] = AwsUtils::sign(aws_secret_access_key, string_to_sign)
62
- service_hash.to_a.collect{|key,val| "#{amz_escape(key)}=#{amz_escape(val.to_s)}" }.join("&")
63
- end
64
-
65
- # Signature Version 1
66
- # Another deprecated guy (should work till septemper 2009)
67
- def self.sign_request_v1(aws_secret_access_key, service_hash)
68
- fix_service_params(service_hash, '1')
69
- string_to_sign = service_hash.sort{|a,b| (a[0].to_s.downcase)<=>(b[0].to_s.downcase)}.to_s
70
- service_hash['Signature'] = AwsUtils::sign(aws_secret_access_key, string_to_sign)
71
- service_hash.to_a.collect{|key,val| "#{amz_escape(key)}=#{amz_escape(val.to_s)}" }.join("&")
72
- end
73
-
74
53
  # Signature Version 2
75
54
  # EC2, SQS and SDB requests must be signed by this guy.
76
55
  # See: http://docs.amazonwebservices.com/AmazonSimpleDB/2007-11-07/DeveloperGuide/index.html?REST_RESTAuth.html
@@ -103,8 +82,7 @@ module Aws
103
82
  # sections of the URI. Only target chars in the query
104
83
  # string should be escaped.
105
84
  def self.URLencode(raw)
106
- e = URI.escape(raw)
107
- e.gsub(/\+/, "%2b")
85
+ URI.escape(raw, /[^-_.!~*'()a-zA-Z\d;\/?:@&=$,\[\]]/)
108
86
  end
109
87
 
110
88
  def self.allow_only(allowed_keys, params)
@@ -143,6 +121,7 @@ module Aws
143
121
 
144
122
  # Text, if found in an error message returned by AWS, indicates that this may be a transient
145
123
  # error. Transient errors are automatically retried with exponential back-off.
124
+
146
125
  AMAZON_PROBLEMS = [ 'internal service error',
147
126
  'is currently unavailable',
148
127
  'no response from',
@@ -237,10 +216,6 @@ module Aws
237
216
 
238
217
  def signed_service_params(aws_secret_access_key, service_hash, http_verb=nil, host=nil, service=nil )
239
218
  case signature_version.to_s
240
- when '0'
241
- AwsUtils::sign_request_v0(aws_secret_access_key, service_hash)
242
- when '1'
243
- AwsUtils::sign_request_v1(aws_secret_access_key, service_hash)
244
219
  when '2'
245
220
  AwsUtils::sign_request_v2(aws_secret_access_key, service_hash, http_verb, host, service)
246
221
  else
@@ -125,7 +125,7 @@ module Aws
125
125
  #
126
126
  service_params = signed_service_params(@aws_secret_access_key, service_hash, :post, @params[:server], service)
127
127
  request = Net::HTTP::Post.new(AwsUtils::URLencode(service))
128
- request['Content-Type'] = 'application/x-www-form-urlencoded'
128
+ request['Content-Type'] = 'application/x-www-form-urlencoded;charset=utf-8'
129
129
  request.body = service_params
130
130
  # prepare output hash
131
131
  { :request => request,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qoobaa-aws-sqs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Jakub Ku\xC5\xBAma"