mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
Convert raw IO errors to ConnectionError. Fixes #274
This commit is contained in:
parent
f7f7733861
commit
e3d87440f6
1 changed files with 18 additions and 14 deletions
|
@ -488,22 +488,26 @@ module Puma
|
|||
return :async
|
||||
end
|
||||
|
||||
res_body.each do |part|
|
||||
if chunked
|
||||
client.syswrite part.bytesize.to_s(16)
|
||||
client.syswrite line_ending
|
||||
fast_write client, part
|
||||
client.syswrite line_ending
|
||||
else
|
||||
fast_write client, part
|
||||
begin
|
||||
res_body.each do |part|
|
||||
if chunked
|
||||
client.syswrite part.bytesize.to_s(16)
|
||||
client.syswrite line_ending
|
||||
fast_write client, part
|
||||
client.syswrite line_ending
|
||||
else
|
||||
fast_write client, part
|
||||
end
|
||||
|
||||
client.flush
|
||||
end
|
||||
|
||||
client.flush
|
||||
end
|
||||
|
||||
if chunked
|
||||
client.syswrite CLOSE_CHUNKED
|
||||
client.flush
|
||||
if chunked
|
||||
client.syswrite CLOSE_CHUNKED
|
||||
client.flush
|
||||
end
|
||||
rescue SystemCallError, IOError
|
||||
raise ConnectionError, "Connection error detected during write"
|
||||
end
|
||||
|
||||
ensure
|
||||
|
|
Loading…
Add table
Reference in a new issue