em_aws 0.1.8 → 0.1.9

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.
@@ -106,42 +106,22 @@ module AWS
106
106
  def handle_it(request, response)
107
107
  #puts "Using EM!!!!"
108
108
  # get, post, put, delete, head
109
- method = request.http_method.downcase.to_sym
110
-
111
- opts = default_request_options.merge(request_options(request))
112
-
109
+ method = request.http_method.downcase.to_sym
110
+ opts = default_request_options.merge(request_options(request))
113
111
  if (method == :get)
114
112
  opts[:query] = request.body
115
113
  else
116
114
  opts[:body] = request.body
117
115
  end
118
-
119
116
  url = fetch_url(request)
120
-
121
117
  begin
122
- http_response = fetch_response(url,method,opts)
123
- rescue Timeout::Error, Errno::ETIMEDOUT => e
124
- response.timeout = true
125
- else
126
- response.body = http_response.response
118
+ http_response = fetch_response(url,method,opts)
127
119
  response.status = http_response.response_header.status.to_i
128
- response.headers = to_aws_headers(http_response.response_header.to_hash)
129
- end
130
- end
131
-
132
- # AWS-SDK expects headers to be downcase and hyphenated, but em-http-request
133
- # returns heads that are caps and underscored
134
- def to_aws_headers(response_headers)
135
- aws_headers = {}
136
- response_headers.each_pair do |k,v|
137
- key = k.downcase.gsub(/\_/,'-')
138
- if (key == "x-amz-expiration" || key == 'x-amz-restore')
139
- aws_headers[key] = [v]
140
- else
141
- aws_headers[key] = v
142
- end
120
+ response.headers = http_response.response_header.raw.to_hash
121
+ response.body = http_response.response if response.status < 300
122
+ rescue *AWS::Core::Http::NetHttpHandler::NETWORK_ERRORS
123
+ response.network_error = true
143
124
  end
144
- aws_headers
145
125
  end
146
126
  end
147
127
  end
@@ -1,3 +1,3 @@
1
1
  module EmAws
2
- VERSION = "0.1.8"
2
+ VERSION = "0.1.9"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: em_aws
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-02 00:00:00.000000000 Z
12
+ date: 2013-01-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aws-sdk