about summary refs log tree commit homepage
path: root/test/test_proxy_pass.rb
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 /test/test_proxy_pass.rb
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 'test/test_proxy_pass.rb')
-rw-r--r--test/test_proxy_pass.rb25
1 files changed, 13 insertions, 12 deletions
diff --git a/test/test_proxy_pass.rb b/test/test_proxy_pass.rb
index 7f752e3..29c5a61 100644
--- a/test/test_proxy_pass.rb
+++ b/test/test_proxy_pass.rb
@@ -1,5 +1,6 @@
 # Copyright (C) 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_relative 'server_helper'
 require 'json'
 require 'digest'
@@ -390,9 +391,9 @@ class TestProxyPass < Testcase
 
   def check_pipelining(host, port)
     pl = TCPSocket.new(host, port)
-    r1 = ''
-    r2 = ''
-    r3 = ''
+    r1 = ''.dup
+    r2 = ''.dup
+    r3 = ''.dup
     Timeout.timeout(60) do
       pl.write "GET / HTTP/1.1\r\nHost: example.com\r\n\r\nGET /"
       until r1 =~ /hi\n/
@@ -415,7 +416,7 @@ class TestProxyPass < Testcase
 
       # ensure stuff still works after a chunked upload:
       pl.write "GET / HTTP/1.1\r\nHost: example.com\r\n\r\nP"
-      after_up = ''
+      after_up = ''.dup
       until after_up =~ /hi\n/
         after_up << pl.readpartial(666)
       end
@@ -426,7 +427,7 @@ class TestProxyPass < Testcase
       pl.write "UT / HTTP/1.1\r\nHost: example.com\r\n"
       pl.write "Content-Length: 8\r\n\r\n"
       pl.write "identity"
-      identity = ''
+      identity = ''.dup
 
       until identity =~ /identity/
         identity << pl.readpartial(666)
@@ -436,7 +437,7 @@ class TestProxyPass < Testcase
 
       # ensure stuff still works after an identity upload:
       pl.write "GET / HTTP/1.1\r\nHost: example.com\r\n\r\n"
-      after_up = ''
+      after_up = ''.dup
       until after_up =~ /hi\n/
         after_up << pl.readpartial(666)
       end
@@ -509,8 +510,8 @@ class TestProxyPass < Testcase
     s = TCPSocket.new(host, port)
     s.write "GET /giant-body HTTP/1.0\r\n\r\n"
     sleep 0.1
-    str = ''
-    buf = ''
+    str = ''.dup
+    buf = ''.dup
     assert_raises(EOFError) { loop { str << s.readpartial(400, buf) } }
     h, b = str.split(/\r\n\r\n/, 2)
     assert_equal OMFG, b
@@ -523,8 +524,8 @@ class TestProxyPass < Testcase
     s = TCPSocket.new(host, port)
     s.write "GET /big-headers HTTP/1.1\r\nHost: example.com\r\n\r\n"
     s.write "HEAD /big-headers HTTP/1.0\r\n\r\n"
-    buf = ''
-    res = ''
+    buf = ''.dup
+    res = ''.dup
     sleep 0.1
     begin
       res << s.readpartial(32786, buf)
@@ -552,8 +553,8 @@ class TestProxyPass < Testcase
         s = TCPSocket.new(host, port)
         s.write "GET /response-trailer HTTP/1.1\r\n#{x}" \
                 "Host: example.com\r\n\r\n"
-        res = ''
-        buf = ''
+        res = ''.dup
+        buf = ''.dup
         Timeout.timeout(60) do
           until res =~ /Foo: bar\r\n\r\n\z/
             res << s.readpartial(16384, buf)