about summary refs log tree commit homepage
path: root/lib/yahns/stream_input.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/yahns/stream_input.rb')
-rw-r--r--lib/yahns/stream_input.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/yahns/stream_input.rb b/lib/yahns/stream_input.rb
index c913ae4..8c0964e 100644
--- a/lib/yahns/stream_input.rb
+++ b/lib/yahns/stream_input.rb
@@ -1,6 +1,7 @@
 # -*- encoding: binary -*-
 # Copyright (C) 2013-2015 all contributors <yahns-public@yhbt.net>
 # License: GPLv2 or later (https://www.gnu.org/licenses/gpl-2.0.txt)
+# frozen_string_literal: true
 
 # When processing uploads, Yahns may expose a StreamInput object under
 # "rack.input" of the (future) Rack (2.x) environment.
@@ -12,7 +13,7 @@ class Yahns::StreamInput # :nodoc:
     @client = client
     @parser = request
     @buf = request.buf
-    @rbuf = ''
+    @rbuf = ''.dup
     @bytes_read = 0
     filter_body(@rbuf, @buf) unless @buf.empty?
   end
@@ -36,7 +37,7 @@ class Yahns::StreamInput # :nodoc:
   # ios.read(length [, buffer]) will return immediately if there is
   # any data and only block when nothing is available (providing
   # IO#readpartial semantics).
-  def read(length = nil, rv = '')
+  def read(length = nil, rv = ''.dup)
     if length
       if length <= @rbuf.size
         length < 0 and raise ArgumentError, "negative length #{length} given"
@@ -79,7 +80,7 @@ class Yahns::StreamInput # :nodoc:
   def gets
     sep = $/
     if sep.nil?
-      read_all(rv = '')
+      read_all(rv = ''.dup)
       return rv.empty? ? nil : rv
     end
     re = /\A(.*?#{Regexp.escape(sep)})/