summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-23 09:36:03 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-23 09:36:03 +0000
commitb5cf8a725a58c93e362fc282022da8df6861847c (patch)
treeaab07dc6fcc5d47e4995223f5b1dd558b7cdb9b5 /lib
parent712da8a819a417a3b3ae68154eef8a3e054de363 (diff)
merge revision(s) 46060: [Backport #9627]
* net/protocol.rb (using_each_crlf_line): fix SMTP dot-stuffing for messages not ending with a new-line. [ruby-core:61441] [Bug #9627] [fix GH-616] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@46515 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/net/protocol.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/net/protocol.rb b/lib/net/protocol.rb
index 14a68e1115..25477014fb 100644
--- a/lib/net/protocol.rb
+++ b/lib/net/protocol.rb
@@ -267,7 +267,7 @@ module Net # :nodoc:
def write_message_0(src)
prev = @written_bytes
each_crlf_line(src) do |line|
- write0 line.sub(/\A\./, '..')
+ write0 dot_stuff(line)
end
@written_bytes - prev
end
@@ -308,11 +308,15 @@ module Net # :nodoc:
private
+ def dot_stuff(s)
+ s.sub(/\A\./, '..')
+ end
+
def using_each_crlf_line
@wbuf = ''
yield
if not @wbuf.empty? # unterminated last line
- write0 @wbuf.chomp + "\r\n"
+ write0 dot_stuff(@wbuf.chomp) + "\r\n"
elsif @written_bytes == 0 # empty src
write0 "\r\n"
end