mirror of
https://github.com/ruby/ruby.git
synced 2025-09-20 02:53:57 +02:00
merge revision(s) 37487,37563: [Backport #7278]
* lib/net/protocol.rb (Net::InternetMessageIO#each_crlf_line): don't use /n in universal regexp. [ruby-dev:46394] [Bug #7278] * lib/net/protocol.rb (Net::InternetMessageIO#each_crlf_line): treat \r as newline as mame pointed. [ruby-dev:46425] [Bug #7278] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@38830 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
73eb0eafef
commit
c35e7519b9
4 changed files with 31 additions and 2 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
Tue Jan 15 16:23:30 2013 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
|
* lib/net/protocol.rb (Net::InternetMessageIO#each_crlf_line):
|
||||||
|
treat \r as newline as mame pointed. [ruby-dev:46425] [Bug #7278]
|
||||||
|
|
||||||
|
Tue Jan 15 16:23:30 2013 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 Jan 15 16:13:47 2013 Kenta Murata <mrkn@mrkn.jp>
|
Tue Jan 15 16:13:47 2013 Kenta Murata <mrkn@mrkn.jp>
|
||||||
|
|
||||||
* ext/bigdecimal/bigdecimal.c (BigDecimal_to_s): use CRuby style.
|
* ext/bigdecimal/bigdecimal.c (BigDecimal_to_s): use CRuby style.
|
||||||
|
|
|
@ -310,7 +310,7 @@ module Net # :nodoc:
|
||||||
|
|
||||||
def each_crlf_line(src)
|
def each_crlf_line(src)
|
||||||
buffer_filling(@wbuf, src) do
|
buffer_filling(@wbuf, src) do
|
||||||
while line = @wbuf.slice!(/\A.*(?:\n|\r\n|\r(?!\z))/n)
|
while line = @wbuf.slice!(/\A[^\r\n]*(?:\n|\r(?:\n|(?!\z)))/)
|
||||||
yield line.chomp("\n") + "\r\n"
|
yield line.chomp("\n") + "\r\n"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
19
test/net/protocol/test_protocol.rb
Normal file
19
test/net/protocol/test_protocol.rb
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
require "test/unit"
|
||||||
|
require "net/protocol"
|
||||||
|
require "stringio"
|
||||||
|
|
||||||
|
class TestProtocol < Test::Unit::TestCase
|
||||||
|
def test_each_crlf_line
|
||||||
|
assert_output('', '') do
|
||||||
|
sio = StringIO.new("")
|
||||||
|
imio = Net::InternetMessageIO.new(sio)
|
||||||
|
assert_equal(23, imio.write_message("\u3042\r\u3044\n\u3046\r\n\u3048"))
|
||||||
|
assert_equal("\u3042\r\n\u3044\r\n\u3046\r\n\u3048\r\n.\r\n", sio.string)
|
||||||
|
|
||||||
|
sio = StringIO.new("")
|
||||||
|
imio = Net::InternetMessageIO.new(sio)
|
||||||
|
assert_equal(8, imio.write_message("\u3042\r"))
|
||||||
|
assert_equal("\u3042\r\n.\r\n", sio.string)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,5 +1,5 @@
|
||||||
#define RUBY_VERSION "1.9.3"
|
#define RUBY_VERSION "1.9.3"
|
||||||
#define RUBY_PATCHLEVEL 370
|
#define RUBY_PATCHLEVEL 371
|
||||||
|
|
||||||
#define RUBY_RELEASE_DATE "2013-01-15"
|
#define RUBY_RELEASE_DATE "2013-01-15"
|
||||||
#define RUBY_RELEASE_YEAR 2013
|
#define RUBY_RELEASE_YEAR 2013
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue