[前][次][番号順一覧][スレッド一覧]

ruby-changes:5762

From: shyouhei <ko1@a...>
Date: Sun, 15 Jun 2008 22:34:05 +0900 (JST)
Subject: [ruby-changes:5762] Ruby:r17268 (ruby_1_8_5): merge revision(s) 16242:

shyouhei	2008-06-15 22:33:53 +0900 (Sun, 15 Jun 2008)

  New Revision: 17268

  Modified files:
    branches/ruby_1_8_5/ChangeLog
    branches/ruby_1_8_5/lib/net/telnet.rb
    branches/ruby_1_8_5/version.h

  Log:
    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.


  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8_5/lib/net/telnet.rb?r1=17268&r2=17267&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8_5/version.h?r1=17268&r2=17267&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8_5/ChangeLog?r1=17268&r2=17267&diff_format=u

Index: ruby_1_8_5/ChangeLog
===================================================================
--- ruby_1_8_5/ChangeLog	(revision 17267)
+++ ruby_1_8_5/ChangeLog	(revision 17268)
@@ -1,3 +1,11 @@
+Sun Jun 15 22:32:39 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.
+
 Sun Jun 15 22:30:30 2008  Nobuyoshi Nakada  <nobu@r...>
 
 	* re.c (rb_reg_search): use local variable.  a patch from wanabe
Index: ruby_1_8_5/version.h
===================================================================
--- ruby_1_8_5/version.h	(revision 17267)
+++ ruby_1_8_5/version.h	(revision 17268)
@@ -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
Index: ruby_1_8_5/lib/net/telnet.rb
===================================================================
--- ruby_1_8_5/lib/net/telnet.rb	(revision 17267)
+++ ruby_1_8_5/lib/net/telnet.rb	(revision 17268)
@@ -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/

[前][次][番号順一覧][スレッド一覧]