about summary refs log tree commit homepage
path: root/extras
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-01-02 22:29:12 +0000
committerEric Wong <e@80x24.org>2016-01-02 22:29:28 +0000
commit9e24bae3428f726800da2963a8f2695f7d4064cd (patch)
treedd4ce29efffa4f0da9c6d9ada903a277ec81196b /extras
parent1105a6957eed26a922a27bd6e6dbbc457524b664 (diff)
downloadyahns-9e24bae3428f726800da2963a8f2695f7d4064cd.tar.gz
There are likely yet-to-be-discovered bugs in here.
Also, keeping explicit #freeze calls for 2.2 users, since most
users have not migrated to 2.3, yet.
Diffstat (limited to 'extras')
-rw-r--r--extras/autoindex.rb1
-rw-r--r--extras/exec_cgi.rb1
-rw-r--r--extras/proxy_pass.rb7
-rw-r--r--extras/try_gzip_static.rb3
4 files changed, 8 insertions, 4 deletions
diff --git a/extras/autoindex.rb b/extras/autoindex.rb
index 1cfde7b..0e47fd4 100644
--- a/extras/autoindex.rb
+++ b/extras/autoindex.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 'rack/utils'
 require 'rack/request'
diff --git a/extras/exec_cgi.rb b/extras/exec_cgi.rb
index 3b63e93..c7f2ba9 100644
--- a/extras/exec_cgi.rb
+++ b/extras/exec_cgi.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
 #
 # if running under yahns, worker_processes is recommended to avoid conflicting
 # with the SIGCHLD handler in yahns.
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)
diff --git a/extras/try_gzip_static.rb b/extras/try_gzip_static.rb
index 4c6a59b..851744b 100644
--- a/extras/try_gzip_static.rb
+++ b/extras/try_gzip_static.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 'rack/utils'
 require 'rack/mime'
@@ -15,7 +16,7 @@ class TryGzipStatic
     # we actually hit this if serving the gzipped file in the first place,
     # _and_ Rack::Deflater is used in the middleware stack.  Oh well...
     def each
-      buf = ""
+      buf = ''.dup
       rsize = 8192
       if @sf_range
         file.seek(@sf_range.begin)