mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/net/protocol.rb (Net::InternetMessageIO#each_crlf_line):
don't use /n in universal regexp. [ruby-dev:46394] [Bug #7278] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37487 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a6ec258452
commit
ccd7a805cc
3 changed files with 17 additions and 1 deletions
|
@ -1,3 +1,8 @@
|
|||
Tue Nov 6 14:25:09 2012 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* lib/net/protocol.rb (Net::InternetMessageIO#each_crlf_line):
|
||||
don't use /n in universal regexp. [ruby-dev:46394] [Bug #7278]
|
||||
|
||||
Tue Nov 6 09:42:26 2012 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* string.c (rb_str_b): Add String#b, returning a copied string
|
||||
|
|
|
@ -322,7 +322,7 @@ module Net # :nodoc:
|
|||
|
||||
def each_crlf_line(src)
|
||||
buffer_filling(@wbuf, src) do
|
||||
while line = @wbuf.slice!(/\A.*(?:\n|\r\n|\r(?!\z))/n)
|
||||
while line = @wbuf.slice!(/\A.*(?:\n|\r\n|\r(?!\z))/)
|
||||
yield line.chomp("\n") + "\r\n"
|
||||
end
|
||||
end
|
||||
|
|
11
test/net/protocol/test_protocol.rb
Normal file
11
test/net/protocol/test_protocol.rb
Normal file
|
@ -0,0 +1,11 @@
|
|||
require "test/unit"
|
||||
require "net/protocol"
|
||||
require "stringio"
|
||||
|
||||
class TestProtocol < Test::Unit::TestCase
|
||||
def test_each_crlf_line
|
||||
assert_output('', '') do
|
||||
Net::InternetMessageIO.new(StringIO.new("")).write_message("\u3042\r\n\u3044\r\n\u3046")
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue