mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
Remove non-rack compliant optimization path
This commit is contained in:
parent
982afa3779
commit
0927fc8dc0
2 changed files with 6 additions and 21 deletions
|
@ -251,9 +251,7 @@ module Puma
|
|||
|
||||
content_length = nil
|
||||
|
||||
if res_body.kind_of? String
|
||||
content_length = res_body.size
|
||||
elsif res_body.kind_of? Array and res_body.size == 1
|
||||
if res_body.kind_of? Array and res_body.size == 1
|
||||
content_length = res_body[0].size
|
||||
end
|
||||
|
||||
|
@ -291,30 +289,17 @@ module Puma
|
|||
|
||||
client.write line_ending
|
||||
|
||||
if res_body.kind_of? String
|
||||
res_body.each do |part|
|
||||
if chunked
|
||||
client.write res_body.size.to_s(16)
|
||||
client.write part.size.to_s(16)
|
||||
client.write line_ending
|
||||
client.write res_body
|
||||
client.write part
|
||||
client.write line_ending
|
||||
else
|
||||
client.write res_body
|
||||
client.write part
|
||||
end
|
||||
|
||||
client.flush
|
||||
else
|
||||
res_body.each do |part|
|
||||
if chunked
|
||||
client.write part.size.to_s(16)
|
||||
client.write line_ending
|
||||
client.write part
|
||||
client.write line_ending
|
||||
else
|
||||
client.write part
|
||||
end
|
||||
|
||||
client.flush
|
||||
end
|
||||
end
|
||||
|
||||
if chunked
|
||||
|
|
|
@ -42,7 +42,7 @@ class TestRackServer < Test::Unit::TestCase
|
|||
def setup
|
||||
@valid_request = "GET / HTTP/1.1\r\nHost: test.com\r\nContent-Type: text/plain\r\n\r\n"
|
||||
|
||||
@simple = lambda { |env| [200, { "X-Header" => "Works" }, "Hello"] }
|
||||
@simple = lambda { |env| [200, { "X-Header" => "Works" }, ["Hello"]] }
|
||||
@server = Puma::Server.new @simple
|
||||
@server.add_tcp_listener "127.0.0.1", 9998
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue