From 9e24bae3428f726800da2963a8f2695f7d4064cd Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 2 Jan 2016 22:29:12 +0000 Subject: enable frozen_string_literal for Ruby 2.3+ 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. --- test/test_proxy_pass.rb | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'test/test_proxy_pass.rb') 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 # 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) -- cgit v1.2.3-24-ge0c7