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:
parent
b9388a6074
commit
7d3c142efa
1 changed files with 5 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue