ruby-changes:4748
From: ko1@a...
Date: Wed, 30 Apr 2008 20:23:29 +0900 (JST)
Subject: [ruby-changes:4748] jeg2 - Ruby:r16242 (ruby_1_8): Merged 16241 from trunk.
jeg2 2008-04-30 20:23:15 +0900 (Wed, 30 Apr 2008)
New Revision: 16242
Modified files:
branches/ruby_1_8/ChangeLog
branches/ruby_1_8/lib/net/telnet.rb
Log:
Merged 16241 from trunk.
* lib/net/telnet.rb: Fixing a bug where line endings would not be properly
escaped when the two character ending was broken up into separate TCP
packets. Issue reported and patched by Brian Candler.
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ChangeLog?r1=16242&r2=16241&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/lib/net/telnet.rb?r1=16242&r2=16241&diff_format=u
Index: ruby_1_8/ChangeLog
===================================================================
--- ruby_1_8/ChangeLog (revision 16241)
+++ ruby_1_8/ChangeLog (revision 16242)
@@ -1,3 +1,11 @@
+Wed Apr 30 20:22:40 2008 James Edward Gray II <jeg2@r...>
+
+ Merged 16241 from trunk.
+
+ * lib/net/telnet.rb: Fixing a bug where line endings would not be properly
+ escaped when the two character ending was broken up into separate TCP
+ packets. Issue reported and patched by Brian Candler.
+
Wed Apr 30 17:47:21 2008 Nobuyoshi Nakada <nobu@r...>
* re.c (rb_reg_search): use local variable. a patch from wanabe
Index: ruby_1_8/lib/net/telnet.rb
===================================================================
--- ruby_1_8/lib/net/telnet.rb (revision 16241)
+++ ruby_1_8/lib/net/telnet.rb (revision 16242)
@@ -559,7 +559,8 @@
Integer(c.rindex(/#{IAC}#{SB}/no))
buf = preprocess(c[0 ... c.rindex(/#{IAC}#{SB}/no)])
rest = c[c.rindex(/#{IAC}#{SB}/no) .. -1]
- elsif pt = c.rindex(/#{IAC}[^#{IAC}#{AO}#{AYT}#{DM}#{IP}#{NOP}]?\z/no)
+ elsif pt = c.rindex(/#{IAC}[^#{IAC}#{AO}#{AYT}#{DM}#{IP}#{NOP}]?\z/no) ||
+ c.rindex(/\r\z/no)
buf = preprocess(c[0 ... pt])
rest = c[pt .. -1]
else
@@ -571,9 +572,15 @@
#
# We cannot use preprocess() on this data, because that
# method makes some Telnetmode-specific assumptions.
- buf = c
- buf.gsub!(/#{EOL}/no, "\n") unless @options["Binmode"]
+ buf = rest + c
rest = ''
+ unless @options["Binmode"]
+ if pt = buf.rindex(/\r\z/no)
+ buf = buf[0 ... pt]
+ rest = buf[pt .. -1]
+ end
+ buf.gsub!(/#{EOL}/no, "\n")
+ end
end
@log.print(buf) if @options.has_key?("Output_log")
line += buf
--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/