Skip to content

Commit 742cc3c

Browse files
committed
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_6@17270 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 9484ce5 commit 742cc3c

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

ChangeLog

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
Sun Jun 15 22:34:09 2008 James Edward Gray II <jeg2@ruby-lang.org>
2+
3+
Merged 16241 from trunk.
4+
5+
* lib/net/telnet.rb: Fixing a bug where line endings would not be properly
6+
escaped when the two character ending was broken up into separate TCP
7+
packets. Issue reported and patched by Brian Candler.
8+
19
Sun Jun 15 22:31:47 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
210

311
* re.c (rb_reg_search): use local variable. a patch from wanabe

lib/net/telnet.rb

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,8 @@ def waitfor(options) # :yield: recvdata
559559
Integer(c.rindex(/#{IAC}#{SB}/no))
560560
buf = preprocess(c[0 ... c.rindex(/#{IAC}#{SB}/no)])
561561
rest = c[c.rindex(/#{IAC}#{SB}/no) .. -1]
562-
elsif pt = c.rindex(/#{IAC}[^#{IAC}#{AO}#{AYT}#{DM}#{IP}#{NOP}]?\z/no)
562+
elsif pt = c.rindex(/#{IAC}[^#{IAC}#{AO}#{AYT}#{DM}#{IP}#{NOP}]?\z/no) ||
563+
c.rindex(/\r\z/no)
563564
buf = preprocess(c[0 ... pt])
564565
rest = c[pt .. -1]
565566
else
@@ -571,9 +572,15 @@ def waitfor(options) # :yield: recvdata
571572
#
572573
# We cannot use preprocess() on this data, because that
573574
# method makes some Telnetmode-specific assumptions.
574-
buf = c
575-
buf.gsub!(/#{EOL}/no, "\n") unless @options["Binmode"]
575+
buf = rest + c
576576
rest = ''
577+
unless @options["Binmode"]
578+
if pt = buf.rindex(/\r\z/no)
579+
buf = buf[0 ... pt]
580+
rest = buf[pt .. -1]
581+
end
582+
buf.gsub!(/#{EOL}/no, "\n")
583+
end
577584
end
578585
@log.print(buf) if @options.has_key?("Output_log")
579586
line += buf

version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#define RUBY_RELEASE_DATE "2008-06-15"
33
#define RUBY_VERSION_CODE 186
44
#define RUBY_RELEASE_CODE 20080615
5-
#define RUBY_PATCHLEVEL 201
5+
#define RUBY_PATCHLEVEL 202
66

77
#define RUBY_VERSION_MAJOR 1
88
#define RUBY_VERSION_MINOR 8

0 commit comments

Comments
 (0)