From 485521dfb11fae64081679e10db0e7523e32591b Mon Sep 17 00:00:00 2001 From: shyouhei Date: Sun, 15 Jun 2008 13:33:53 +0000 Subject: merge revision(s) 16242: 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_5@17268 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 8 ++++++++ lib/net/telnet.rb | 13 ++++++++++--- version.h | 2 +- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 344f52bde4..b26070c630 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Sun Jun 15 22:32:39 2008 James Edward Gray II + + 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. + Sun Jun 15 22:30:30 2008 Nobuyoshi Nakada * re.c (rb_reg_search): use local variable. a patch from wanabe diff --git a/lib/net/telnet.rb b/lib/net/telnet.rb index c54401851c..a79537b649 100644 --- a/lib/net/telnet.rb +++ b/lib/net/telnet.rb @@ -559,7 +559,8 @@ module Net 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 @@ module Net # # 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 diff --git a/version.h b/version.h index 1517187365..09660a5a31 100644 --- a/version.h +++ b/version.h @@ -2,7 +2,7 @@ #define RUBY_RELEASE_DATE "2008-06-15" #define RUBY_VERSION_CODE 185 #define RUBY_RELEASE_CODE 20080615 -#define RUBY_PATCHLEVEL 200 +#define RUBY_PATCHLEVEL 201 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 8 -- cgit v1.2.3