Skip to content

Commit 242d7a5

Browse files
committed
update excon, pass a block instead of params[:block]
1 parent 1a1985d commit 242d7a5

7 files changed

Lines changed: 53 additions & 52 deletions

File tree

‎Gemfile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
source 'http://gemcutter.org'
22

33
gem 'rake'
4-
gem 'excon', '>= 0.0.21'
4+
gem 'excon', '>= 0.0.22'
55
gem 'formatador', ">= 0.0.10"
66
gem 'json', ">= 0"
77
gem 'mime-types', ">= 0"

‎Gemfile.lock‎

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,69 @@
11
---
2-
specs:
3-
- rake:
4-
version: 0.8.7
5-
- excon:
6-
version: 0.0.21
7-
- formatador:
8-
version: 0.0.14
9-
- gestalt:
10-
version: 0.0.6
11-
- json:
12-
version: 1.4.2
13-
- mime-types:
14-
version: "1.16"
15-
- net-ssh:
16-
version: 2.0.22
17-
- nokogiri:
18-
version: 1.4.1
19-
- rspec:
20-
version: 1.3.0
21-
- ruby-hmac:
22-
version: 0.4.0
23-
- shindo:
24-
version: 0.0.18
25-
hash: e443f12a9a7794f2ff4fc8e8d201b12b1e8b30bb
26-
sources:
27-
- Rubygems:
28-
uri: http://gemcutter.org
292
dependencies:
303
formatador:
31-
version: ">= 0.0.10"
32-
group:
33-
- :default
34-
nokogiri:
35-
version: ">= 0"
364
group:
375
- :default
6+
version: ">= 0.0.10"
387
rake:
39-
version: ">= 0"
408
group:
419
- :default
42-
rspec:
4310
version: ">= 0"
11+
ruby-hmac:
4412
group:
4513
- :default
46-
ruby-hmac:
4714
version: ">= 0"
15+
mime-types:
4816
group:
4917
- :default
50-
mime-types:
5118
version: ">= 0"
19+
rspec:
5220
group:
5321
- :default
54-
net-ssh:
5522
version: ">= 0"
23+
net-ssh:
5624
group:
5725
- :default
58-
json:
5926
version: ">= 0"
27+
json:
6028
group:
6129
- :default
30+
version: ">= 0"
6231
excon:
63-
version: ">= 0.0.21"
6432
group:
6533
- :default
34+
version: ">= 0.0.22"
6635
shindo:
36+
group:
37+
- :default
6738
version: ">= 0"
39+
nokogiri:
6840
group:
6941
- :default
42+
version: ">= 0"
43+
specs:
44+
- rake:
45+
version: 0.8.7
46+
- excon:
47+
version: 0.0.22
48+
- formatador:
49+
version: 0.0.14
50+
- gestalt:
51+
version: 0.0.6
52+
- json:
53+
version: 1.4.3
54+
- mime-types:
55+
version: "1.16"
56+
- net-ssh:
57+
version: 2.0.22
58+
- nokogiri:
59+
version: 1.4.1
60+
- rspec:
61+
version: 1.3.0
62+
- ruby-hmac:
63+
version: 0.4.0
64+
- shindo:
65+
version: 0.0.18
66+
hash: a39d842433b002231eebfd269d32fe72b489b62f
67+
sources:
68+
- Rubygems:
69+
uri: http://gemcutter.org

‎lib/fog/aws/requests/s3/get_object.rb‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,13 @@ def get_object(bucket_name, object_name, options = {}, &block)
3434
headers['If-Unmodified-Since'] = options['If-Unmodified-Since'].utc.strftime("%a, %d %b %Y %H:%M:%S +0000") if options['If-Modified-Since']
3535
headers.merge!(options)
3636
request({
37-
:block => block,
3837
:expects => 200,
3938
:headers => headers,
4039
:host => "#{bucket_name}.#{@host}",
4140
:idempotent => true,
4241
:method => 'GET',
4342
:path => CGI.escape(object_name)
44-
})
43+
}, &block)
4544
end
4645

4746
def get_object_url(bucket_name, object_name, expires)

‎lib/fog/aws/s3.rb‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,12 @@ def initialize(options={})
141141

142142
private
143143

144-
def request(params)
144+
def request(params, &block)
145145
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}")
146146
params[:headers]['Date'] = Time.now.utc.strftime("%a, %d %b %Y %H:%M:%S +0000")
147147
params[:headers]['Authorization'] = "AWS #{@aws_access_key_id}:#{signature(params)}"
148148

149-
response = @connection.request(params)
149+
response = @connection.request(params, &block)
150150

151151
response
152152
end

‎lib/fog/connection.rb‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@ def initialize(url)
55
@excon = Excon.new(url)
66
end
77

8-
def request(params)
9-
if parser = params.delete(:parser)
10-
body = Nokogiri::XML::SAX::PushParser.new(parser)
11-
params[:block] = lambda { |chunk| body << chunk }
8+
def request(params, &block)
9+
unless block_given?
10+
if (parser = params.delete(:parser))
11+
body = Nokogiri::XML::SAX::PushParser.new(parser)
12+
block = lambda { |chunk| body << chunk }
13+
end
1214
end
1315

14-
response = @excon.request(params)
16+
response = @excon.request(params, &block)
1517

1618
if parser
1719
body.finish

‎lib/fog/rackspace/files.rb‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def cdn_request(params)
112112
response
113113
end
114114

115-
def storage_request(params, parse_json = true)
115+
def storage_request(params, parse_json = true, &block)
116116
@storage_connection = Fog::Connection.new("#{@storage_scheme}://#{@storage_host}:#{@storage_port}")
117117
response = @storage_connection.request({
118118
:body => params[:body],
@@ -125,7 +125,7 @@ def storage_request(params, parse_json = true)
125125
:method => params[:method],
126126
:path => "#{@storage_path}/#{params[:path]}",
127127
:query => params[:query]
128-
})
128+
}, &block)
129129
if !response.body.empty? && parse_json
130130
response.body = JSON.parse(response.body)
131131
end

‎lib/fog/rackspace/requests/files/get_object.rb‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def get_object(container, object, &block)
1515
:expects => 200,
1616
:method => 'GET',
1717
:path => "#{CGI.escape(container)}/#{CGI.escape(object)}"
18-
}, false)
18+
}, false, &block)
1919
response
2020
end
2121

0 commit comments

Comments
 (0)