mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
more small tweaks/cleanup
This commit is contained in:
parent
7cd3f1a2ff
commit
901630bfe7
2 changed files with 5 additions and 6 deletions
|
@ -19,7 +19,7 @@ raws.logger.level = 3 # ERROR
|
||||||
|
|
||||||
TIMES = 100
|
TIMES = 100
|
||||||
|
|
||||||
Benchmark.bm(25) do |bench|
|
Benchmark.bmbm(25) do |bench|
|
||||||
bench.report('fog.put_bucket') do
|
bench.report('fog.put_bucket') do
|
||||||
fog.put_bucket('fogbench')
|
fog.put_bucket('fogbench')
|
||||||
end
|
end
|
||||||
|
|
|
@ -57,14 +57,13 @@ module Fog
|
||||||
response.headers[header[0]] = header[1]
|
response.headers[header[0]] = header[1]
|
||||||
end
|
end
|
||||||
if response.headers['Content-Length']
|
if response.headers['Content-Length']
|
||||||
content_length = response.headers['Content-Length'].to_i
|
response.body << @connection.read(response.headers['Content-Length'].to_i)
|
||||||
response.body << @connection.read(content_length)
|
|
||||||
elsif response.headers['Transfer-Encoding'] == 'chunked'
|
elsif response.headers['Transfer-Encoding'] == 'chunked'
|
||||||
while true
|
while true
|
||||||
@connection.readline =~ /([a-f0-9]*)\r\n/i
|
# 2 == "/r/n".length
|
||||||
chunk_size = $1.to_i(16) + 2 # 2 = "/r/n".length
|
chunk_size = @connection.readline.chomp!.to_i(16) + 2
|
||||||
response.body << @connection.read(chunk_size)
|
response.body << @connection.read(chunk_size)
|
||||||
if $1.to_i(16) == 0
|
if chunk_size == 2
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue