Issue #6436 has been updated by mame (Yusuke Endoh).

Status changed from Open to Assigned
Assignee set to nobu (Nobuyoshi Nakada)

Thanks Jeremie,
Could you add a test to test/net/http/test_buffered_io.rb ?

Nobu, can you review the patch?

-- 
Yusuke Endoh <mame / tsg.ne.jp>
----------------------------------------
Bug #6436: Byte counting incorrect in BufferedIO (net/protocol.rb)
https://bugs.ruby-lang.org/issues/6436#change-26667

Author: jcast (Jeremie Castagna)
Status: Assigned
Priority: Normal
Assignee: nobu (Nobuyoshi Nakada)
Category: 
Target version: 
ruby -v: 1.9


BufferedIO's @rbuf counts bytes with String#size, but should use String#bytesize. This creates potential incorrect reading of a HTTP body when changing the encoding of each chuck passed by HTTP#read_body:

http.read_body do |chunk|
  chunk.force_encoding "UTF-8"
end


-- 
http://bugs.ruby-lang.org/