Project

General

Profile

Bug #6436

Byte counting incorrect in BufferedIO (net/protocol.rb)

Added by jcast (Jeremie Castagna) about 7 years ago. Updated about 7 years ago.

Status:
Assigned
Priority:
Normal
Target version:
-
ruby -v:
1.9
Backport:
[ruby-core:45062]

Description

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


Files

protocol.patch (4.39 KB) protocol.patch jcast (Jeremie Castagna), 05/16/2012 05:27 AM
protocol.patch (2.63 KB) protocol.patch nobu (Nobuyoshi Nakada), 05/16/2012 10:05 AM

History

Updated by nobu (Nobuyoshi Nakada) about 7 years ago

Emacs diff-mode.el provides a function, diff-context->unified.

Updated by mame (Yusuke Endoh) about 7 years ago

  • 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

Also available in: Atom PDF