about summary refs log tree commit homepage
path: root/test/test_server.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_server.rb')
-rw-r--r--test/test_server.rb17
1 files changed, 9 insertions, 8 deletions
diff --git a/test/test_server.rb b/test/test_server.rb
index c753919..a2c5ea2 100644
--- a/test/test_server.rb
+++ b/test/test_server.rb
@@ -1,5 +1,6 @@
 # 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_relative 'server_helper'
 
 class TestServer < Testcase
@@ -25,7 +26,7 @@ class TestServer < Testcase
     # test pipelining
     r = "GET / HTTP/1.1\r\nHost: example.com\r\n\r\n"
     c.write(r + r)
-    buf = ""
+    buf = ''.dup
     Timeout.timeout(10) do
       until buf =~ /HI.+HI/m
         buf << c.readpartial(4096)
@@ -34,7 +35,7 @@ class TestServer < Testcase
 
     # trickle pipelining
     c.write(r + "GET ")
-    buf = ""
+    buf = ''.dup
     Timeout.timeout(10) do
       until buf =~ /HI\z/
         buf << c.readpartial(4096)
@@ -91,7 +92,7 @@ class TestServer < Testcase
     buf = "PUT / HTTP/1.1\r\nContent-Length: 2\r\n\r\nHI"
     c = get_tcp_client(host, port)
     c.write(buf + buf)
-    buf = ""
+    buf = ''.dup
     Timeout.timeout(10) do
       until buf =~ /HI.+HI/m
         buf << c.readpartial(4096)
@@ -110,7 +111,7 @@ class TestServer < Testcase
       sleep(0.01) if b.chr == ":"
       Thread.pass
     end
-    buf = ""
+    buf = ''.dup
     Timeout.timeout(10) do
       until buf =~ /HIBYE.+HIBYE/m
         buf << c.readpartial(4096)
@@ -709,7 +710,7 @@ class TestServer < Testcase
     c = get_tcp_client(host, port)
     c.write "GET / HTTP/1.1\r\nHost: example.com\r\n\r\n"
     assert_equal c, c.wait(30)
-    buf = ""
+    buf = ''.dup
     re = /\r\n\r\nOK\z/
     Timeout.timeout(30) do
       begin
@@ -781,7 +782,7 @@ class TestServer < Testcase
 
     # normal response
     c.write "GET /keep-alive HTTP/1.1\r\nHost: example.com\r\n\r\n"
-    buf = ""
+    buf = ''.dup
     Timeout.timeout(30) do
       buf << c.readpartial(4096) until buf =~ /HI\z/
     end
@@ -790,7 +791,7 @@ class TestServer < Testcase
 
     # we allow whatever in the response, but don't send it
     c.write "GET /whatever HTTP/1.1\r\nHost: example.com\r\n\r\n"
-    buf = ""
+    buf = ''.dup
     Timeout.timeout(30) do
       buf << c.readpartial(4096) until buf =~ /HI\z/
     end
@@ -798,7 +799,7 @@ class TestServer < Testcase
     assert_raises(Errno::EAGAIN,IO::WaitReadable) { c.read_nonblock(666) }
 
     c.write "GET /close HTTP/1.1\r\nHost: example.com\r\n\r\n"
-    buf = ""
+    buf = ''.dup
     Timeout.timeout(30) do
       buf << c.readpartial(4096) until buf =~ /HI\z/
     end