excon 0.5.4 → 0.5.5
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of excon might be problematic. Click here for more details.
- data/changelog.txt +5 -0
- data/excon.gemspec +1 -1
- data/lib/excon.rb +1 -1
- data/lib/excon/response.rb +9 -9
- metadata +3 -3
data/changelog.txt
CHANGED
data/excon.gemspec
CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
|
|
13
13
|
## If your rubyforge_project name is different, then edit it and comment out
|
14
14
|
## the sub! line in the Rakefile
|
15
15
|
s.name = 'excon'
|
16
|
-
s.version = '0.5.
|
16
|
+
s.version = '0.5.5'
|
17
17
|
s.date = '2011-02-18'
|
18
18
|
s.rubyforge_project = 'excon'
|
19
19
|
|
data/lib/excon.rb
CHANGED
data/lib/excon/response.rb
CHANGED
@@ -16,11 +16,11 @@ module Excon
|
|
16
16
|
key, value = data.split(': ')
|
17
17
|
response.headers[key] = value
|
18
18
|
if key.casecmp('Content-Length') == 0
|
19
|
-
|
19
|
+
content_length = value.to_i
|
20
20
|
elsif (key.casecmp('Transfer-Encoding') == 0) && (value.casecmp('chunked') == 0)
|
21
|
-
|
21
|
+
transfer_encoding_chunked = true
|
22
22
|
elsif (key.casecmp('Connection') == 0) && (value.casecmp('close') == 0)
|
23
|
-
|
23
|
+
connection_close = true
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
@@ -32,30 +32,30 @@ module Excon
|
|
32
32
|
end
|
33
33
|
|
34
34
|
if block_given
|
35
|
-
if
|
35
|
+
if transfer_encoding_chunked
|
36
36
|
while (chunk_size = socket.readline.chop!.to_i(16)) > 0
|
37
37
|
yield socket.read(chunk_size + 2).chop! # 2 == "/r/n".length
|
38
38
|
end
|
39
39
|
socket.read(2) # 2 == "/r/n".length
|
40
|
-
elsif
|
40
|
+
elsif connection_close
|
41
41
|
yield socket.read
|
42
42
|
else
|
43
|
-
remaining =
|
43
|
+
remaining = content_length
|
44
44
|
while remaining > 0
|
45
45
|
yield socket.read([CHUNK_SIZE, remaining].min)
|
46
46
|
remaining -= CHUNK_SIZE
|
47
47
|
end
|
48
48
|
end
|
49
49
|
else
|
50
|
-
if
|
50
|
+
if transfer_encoding_chunked
|
51
51
|
while (chunk_size = socket.readline.chop!.to_i(16)) > 0
|
52
52
|
response.body << socket.read(chunk_size + 2).chop! # 2 == "/r/n".length
|
53
53
|
end
|
54
54
|
socket.read(2) # 2 == "/r/n".length
|
55
|
-
elsif
|
55
|
+
elsif connection_close
|
56
56
|
response.body << socket.read
|
57
57
|
else
|
58
|
-
remaining =
|
58
|
+
remaining = content_length
|
59
59
|
while remaining > 0
|
60
60
|
response.body << socket.read([CHUNK_SIZE, remaining].min)
|
61
61
|
remaining -= CHUNK_SIZE
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: excon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 1
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 0.5.
|
9
|
+
- 5
|
10
|
+
version: 0.5.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- geemus (Wesley Beary)
|