From b25dc5d128536a9759190b4a496be69b35e38eda Mon Sep 17 00:00:00 2001 From: Pat Allan Date: Thu, 3 Aug 2017 11:02:40 +1000 Subject: [PATCH] Updates for frozen string literal compatibility. (#1376) --- lib/puma/cluster.rb | 4 ++-- lib/puma/configuration.rb | 2 +- lib/puma/launcher.rb | 4 ++-- test/test_http11.rb | 4 ++-- test/test_persistent.rb | 6 +++--- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/puma/cluster.rb b/lib/puma/cluster.rb index 7bd3cc4c..d4c19578 100644 --- a/lib/puma/cluster.rb +++ b/lib/puma/cluster.rb @@ -229,8 +229,8 @@ module Puma end def worker(index, master) - title = "puma: cluster worker #{index}: #{master}" - title << " [#{@options[:tag]}]" if @options[:tag] && !@options[:tag].empty? + title = "puma: cluster worker #{index}: #{master}" + title += " [#{@options[:tag]}]" if @options[:tag] && !@options[:tag].empty? $0 = title Signal.trap "SIGINT", "IGNORE" diff --git a/lib/puma/configuration.rb b/lib/puma/configuration.rb index 47f9401e..1aea28bb 100644 --- a/lib/puma/configuration.rb +++ b/lib/puma/configuration.rb @@ -341,7 +341,7 @@ module Puma end if bytes - token = "" + token = "".dup bytes.each_byte { |b| token << b.to_s(16) } else token = (0..count).to_a.map { rand(255).to_s(16) }.join diff --git a/lib/puma/launcher.rb b/lib/puma/launcher.rb index ea1c301e..48867b2c 100644 --- a/lib/puma/launcher.rb +++ b/lib/puma/launcher.rb @@ -298,8 +298,8 @@ module Puma end def title - buffer = "puma #{Puma::Const::VERSION} (#{@options[:binds].join(',')})" - buffer << " [#{@options[:tag]}]" if @options[:tag] && !@options[:tag].empty? + buffer = "puma #{Puma::Const::VERSION} (#{@options[:binds].join(',')})" + buffer += " [#{@options[:tag]}]" if @options[:tag] && !@options[:tag].empty? buffer end diff --git a/test/test_http11.rb b/test/test_http11.rb index 3eb72fec..2a300470 100644 --- a/test/test_http11.rb +++ b/test/test_http11.rb @@ -166,8 +166,8 @@ class Http11ParserTest < Minitest::Test end # then large headers are rejected too - get = "GET /#{rand_data(10,120)} HTTP/1.1\r\n" - get << "X-Test: test\r\n" * (80 * 1024) + get = "GET /#{rand_data(10,120)} HTTP/1.1\r\n" + get += "X-Test: test\r\n" * (80 * 1024) assert_raises Puma::HttpParserError do parser.execute({}, get, 0) parser.reset diff --git a/test/test_persistent.rb b/test/test_persistent.rb index 42e35b0a..94d7cc19 100644 --- a/test/test_persistent.rb +++ b/test/test_persistent.rb @@ -37,7 +37,7 @@ class TestPersistent < Minitest::Test end def lines(count, s=@client) - str = "" + str = "".dup Timeout.timeout(5) do count.times { str << s.gets } end @@ -192,7 +192,7 @@ class TestPersistent < Minitest::Test @server.persistent_timeout = 3 req = @valid_request.to_s - req << "GET /second HTTP/1.1\r\nHost: test.com\r\nContent-Type: text/plain\r\n\r\n" + req += "GET /second HTTP/1.1\r\nHost: test.com\r\nContent-Type: text/plain\r\n\r\n" @client << req @@ -209,7 +209,7 @@ class TestPersistent < Minitest::Test @server.persistent_timeout = 3 req = @valid_request.to_s - req << "GET /second HTTP/1.1\r\nHost: test.com\r\nContent-Type: text/plain\r\n\r\n" + req += "GET /second HTTP/1.1\r\nHost: test.com\r\nContent-Type: text/plain\r\n\r\n" @client << req