diff options
author | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-05-03 23:42:26 +0000 |
---|---|---|
committer | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-05-03 23:42:26 +0000 |
commit | 57c1406697134de5e6fe11f19d478472b6ac5323 (patch) | |
tree | 95569e91d6c1b3fa273e41688557fd5604d634f7 /lib | |
parent | e6ccffd96619ab4c7926eaa96fbc8166024201d4 (diff) | |
download | ruby-57c1406697134de5e6fe11f19d478472b6ac5323.tar.gz |
* 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.rb | 8 |
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 |