about summary refs log tree commit homepage
path: root/extras/proxy_pass.rb
diff options
context:
space:
mode:
Diffstat (limited to 'extras/proxy_pass.rb')
-rw-r--r--extras/proxy_pass.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/extras/proxy_pass.rb b/extras/proxy_pass.rb
index 29dd995..ca5a6b2 100644
--- a/extras/proxy_pass.rb
+++ b/extras/proxy_pass.rb
@@ -1,6 +1,7 @@
 # -*- encoding: binary -*-
 # Copyright (C) 2013-2015 all contributors <yahns-public@yhbt.net>
 # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
+# frozen_string_literal: true
 require 'time'
 require 'socket'
 require 'kgio'
@@ -45,7 +46,7 @@ class ProxyPass # :nodoc:
       tout
     end
 
-    def readpartial(bytes, buf = Thread.current[:proxy_pass_buf] ||= "")
+    def readpartial(bytes, buf = Thread.current[:proxy_pass_buf] ||= ''.dup)
       case rv = kgio_read!(bytes, buf)
       when String
         @expiry += @timeout # bump expiry when we succeed
@@ -145,7 +146,7 @@ class ProxyPass # :nodoc:
     req = Rack::Request.new(env)
     path = @path.gsub(/\$(\w+)/) { req.__send__($1) }
     req = "#{request_method} #{path} HTTP/1.1\r\n" \
-          "X-Forwarded-For: #{env["REMOTE_ADDR"]}\r\n"
+          "X-Forwarded-For: #{env["REMOTE_ADDR"]}\r\n".dup
 
     # pass most HTTP_* headers through as-is
     chunked = false
@@ -198,7 +199,7 @@ class ProxyPass # :nodoc:
   end
 
   def send_body(input, ures, chunked)
-    buf = Thread.current[:proxy_pass_buf] ||= ""
+    buf = Thread.current[:proxy_pass_buf] ||= ''.dup
 
     if chunked # unlikely
       while input.read(16384, buf)