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

Buffer mgmt is faster than many write(2) calls

This commit is contained in:
Evan Phoenix 2012-08-10 17:02:54 -07:00
parent b9388a6074
commit 7d3c142efa

View file

@ -390,6 +390,8 @@ module Puma
colon = COLON
line_ending = LINE_END
lines = []
headers.each do |k, vs|
case k
when CONTENT_LENGTH2
@ -403,13 +405,12 @@ module Puma
end
vs.split(NEWLINE).each do |v|
client.write k
client.write colon
client.write v
client.write line_ending
lines << (k + colon + v + line_ending)
end
end
client.write lines.join
if no_body
client.write line_ending
return keep_alive