summaryrefslogtreecommitdiff
path: root/ext/openssl/lib/openssl/buffering.rb
diff options
context:
space:
mode:
Diffstat (limited to 'ext/openssl/lib/openssl/buffering.rb')
-rw-r--r--ext/openssl/lib/openssl/buffering.rb8
1 files changed, 3 insertions, 5 deletions
diff --git a/ext/openssl/lib/openssl/buffering.rb b/ext/openssl/lib/openssl/buffering.rb
index 935f61f0ef..1f2b2a7e44 100644
--- a/ext/openssl/lib/openssl/buffering.rb
+++ b/ext/openssl/lib/openssl/buffering.rb
@@ -316,8 +316,8 @@ module OpenSSL::Buffering
@wbuffer << s
@wbuffer.force_encoding(Encoding::BINARY)
@sync ||= false
- if @sync or @wbuffer.size > BLOCK_SIZE or idx = @wbuffer.rindex($/)
- remain = idx ? idx + $/.size : @wbuffer.length
+ if @sync or @wbuffer.size > BLOCK_SIZE or idx = @wbuffer.rindex("\n")
+ remain = idx ? idx + 1 : @wbuffer.size
nwritten = 0
while remain > 0
str = @wbuffer[nwritten,remain]
@@ -409,9 +409,7 @@ module OpenSSL::Buffering
end
args.each{|arg|
s << arg.to_s
- if $/ && /\n\z/ !~ s
- s << "\n"
- end
+ s.sub!(/(?<!\n)\z/, "\n")
}
do_write(s)
nil