summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-05-03 23:42:26 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-05-03 23:42:26 +0000
commit57c1406697134de5e6fe11f19d478472b6ac5323 (patch)
tree95569e91d6c1b3fa273e41688557fd5604d634f7 /lib
parente6ccffd96619ab4c7926eaa96fbc8166024201d4 (diff)
* lib/net/http.rb (Net::HTTPResponse#read_chunked): ensure to skip the
last newline of chunk. [ruby-core:29229] * test/net/http/utils.rb: add an option for chunked response test. * test/net/http/test_http.rb: add tests for chunked response. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27605 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/net/http.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/net/http.rb b/lib/net/http.rb
index ebe51496f6..f39451591f 100644
--- a/lib/net/http.rb
+++ b/lib/net/http.rb
@@ -2433,8 +2433,12 @@ module Net #:nodoc:
raise HTTPBadResponse, "wrong chunk size line: #{line}"
len = hexlen.hex
break if len == 0
- @socket.read len, dest; total += len
- @socket.read 2 # \r\n
+ begin
+ @socket.read len, dest
+ ensure
+ total += len
+ @socket.read 2 # \r\n
+ end
end
until @socket.readline.empty?
# none