1
0
Fork 0
mirror of https://github.com/puma/puma.git synced 2022-11-09 13:48:40 -05:00

Updates for frozen string literal compatibility. (#1376)

This commit is contained in:
Pat Allan 2017-08-03 11:02:40 +10:00 committed by Nate Berkopec
parent 4db1dcd281
commit b25dc5d128
5 changed files with 10 additions and 10 deletions

View file

@ -229,8 +229,8 @@ module Puma
end end
def worker(index, master) def worker(index, master)
title = "puma: cluster worker #{index}: #{master}" title = "puma: cluster worker #{index}: #{master}"
title << " [#{@options[:tag]}]" if @options[:tag] && !@options[:tag].empty? title += " [#{@options[:tag]}]" if @options[:tag] && !@options[:tag].empty?
$0 = title $0 = title
Signal.trap "SIGINT", "IGNORE" Signal.trap "SIGINT", "IGNORE"

View file

@ -341,7 +341,7 @@ module Puma
end end
if bytes if bytes
token = "" token = "".dup
bytes.each_byte { |b| token << b.to_s(16) } bytes.each_byte { |b| token << b.to_s(16) }
else else
token = (0..count).to_a.map { rand(255).to_s(16) }.join token = (0..count).to_a.map { rand(255).to_s(16) }.join

View file

@ -298,8 +298,8 @@ module Puma
end end
def title def title
buffer = "puma #{Puma::Const::VERSION} (#{@options[:binds].join(',')})" buffer = "puma #{Puma::Const::VERSION} (#{@options[:binds].join(',')})"
buffer << " [#{@options[:tag]}]" if @options[:tag] && !@options[:tag].empty? buffer += " [#{@options[:tag]}]" if @options[:tag] && !@options[:tag].empty?
buffer buffer
end end

View file

@ -166,8 +166,8 @@ class Http11ParserTest < Minitest::Test
end end
# then large headers are rejected too # then large headers are rejected too
get = "GET /#{rand_data(10,120)} HTTP/1.1\r\n" get = "GET /#{rand_data(10,120)} HTTP/1.1\r\n"
get << "X-Test: test\r\n" * (80 * 1024) get += "X-Test: test\r\n" * (80 * 1024)
assert_raises Puma::HttpParserError do assert_raises Puma::HttpParserError do
parser.execute({}, get, 0) parser.execute({}, get, 0)
parser.reset parser.reset

View file

@ -37,7 +37,7 @@ class TestPersistent < Minitest::Test
end end
def lines(count, s=@client) def lines(count, s=@client)
str = "" str = "".dup
Timeout.timeout(5) do Timeout.timeout(5) do
count.times { str << s.gets } count.times { str << s.gets }
end end
@ -192,7 +192,7 @@ class TestPersistent < Minitest::Test
@server.persistent_timeout = 3 @server.persistent_timeout = 3
req = @valid_request.to_s 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 @client << req
@ -209,7 +209,7 @@ class TestPersistent < Minitest::Test
@server.persistent_timeout = 3 @server.persistent_timeout = 3
req = @valid_request.to_s 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 @client << req