Revert "net/protocol: use binary string buffers"

Oops, not ready, yet (will work on this tomorrow :x).
This reverts commit r61638

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61640 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
normal 2018-01-06 09:23:43 +00:00
parent e56d34001f
commit 0d63d4eee6

View File

@ -84,7 +84,7 @@ module Net # :nodoc:
@read_timeout = read_timeout @read_timeout = read_timeout
@continue_timeout = continue_timeout @continue_timeout = continue_timeout
@debug_output = debug_output @debug_output = debug_output
@rbuf = ''.b @rbuf = ''.dup
end end
attr_reader :io attr_reader :io
@ -114,7 +114,7 @@ module Net # :nodoc:
public public
def read(len, dest = ''.b, ignore_eof = false) def read(len, dest = ''.dup, ignore_eof = false)
LOG "reading #{len} bytes..." LOG "reading #{len} bytes..."
read_bytes = 0 read_bytes = 0
begin begin
@ -134,7 +134,7 @@ module Net # :nodoc:
dest dest
end end
def read_all(dest = ''.b) def read_all(dest = ''.dup)
LOG 'reading all...' LOG 'reading all...'
read_bytes = 0 read_bytes = 0
begin begin
@ -193,7 +193,7 @@ module Net # :nodoc:
def rbuf_consume(len) def rbuf_consume(len)
if len == @rbuf.size if len == @rbuf.size
s = @rbuf s = @rbuf
@rbuf = ''.b @rbuf = ''.dup
else else
s = @rbuf.slice!(0, len) s = @rbuf.slice!(0, len)
end end
@ -340,7 +340,7 @@ module Net # :nodoc:
end end
def using_each_crlf_line def using_each_crlf_line
@wbuf = ''.b @wbuf = ''.dup
yield yield
if not @wbuf.empty? # unterminated last line if not @wbuf.empty? # unterminated last line
write0 dot_stuff(@wbuf.chomp) + "\r\n" write0 dot_stuff(@wbuf.chomp) + "\r\n"