aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--lib/net/protocol.rb2
-rw-r--r--test/net/protocol/test_protocol.rb11
3 files changed, 17 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 8e4b50a20d..8ef0432657 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/lib/net/protocol.rb b/lib/net/protocol.rb
index 9733d56c93..6b79f9efcc 100644
--- a/lib/net/protocol.rb
+++ b/lib/net/protocol.rb
@@ -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
diff --git a/test/net/protocol/test_protocol.rb b/test/net/protocol/test_protocol.rb
new file mode 100644
index 0000000000..5fe3023015
--- /dev/null
+++ b/test/net/protocol/test_protocol.rb
@@ -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