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

ruby-changes:5763

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

shyouhei	2008-06-15 22:34:40 +0900 (Sun, 15 Jun 2008)

  New Revision: 17270

  Modified files:
    branches/ruby_1_8_6/ChangeLog
    branches/ruby_1_8_6/lib/net/telnet.rb
    branches/ruby_1_8_6/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_6/ChangeLog?r1=17270&r2=17269&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8_6/version.h?r1=17270&r2=17269&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8_6/lib/net/telnet.rb?r1=17270&r2=17269&diff_format=u

Index: ruby_1_8_6/ChangeLog
===================================================================
--- ruby_1_8_6/ChangeLog	(revision 17269)
+++ ruby_1_8_6/ChangeLog	(revision 17270)
@@ -1,3 +1,11 @@
+Sun Jun 15 22:34:09 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:31:47 2008  Nobuyoshi Nakada  <nobu@r...>
 
 	* re.c (rb_reg_search): use local variable.  a patch from wanabe
Index: ruby_1_8_6/version.h
===================================================================
--- ruby_1_8_6/version.h	(revision 17269)
+++ ruby_1_8_6/version.h	(revision 17270)
@@ -2,7 +2,7 @@
 #define RUBY_RELEASE_DATE "2008-06-15"
 #define RUBY_VERSION_CODE 186
 #define RUBY_RELEASE_CODE 20080615
-#define RUBY_PATCHLEVEL 201
+#define RUBY_PATCHLEVEL 202
 
 #define RUBY_VERSION_MAJOR 1
 #define RUBY_VERSION_MINOR 8
Index: ruby_1_8_6/lib/net/telnet.rb
===================================================================
--- ruby_1_8_6/lib/net/telnet.rb	(revision 17269)
+++ ruby_1_8_6/lib/net/telnet.rb	(revision 17270)
@@ -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/

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