mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
Fix for issue 350.
Within MiniSSL#read_nonblock it was possible for all data to be read from the network connection but only partially read from the engine on the first attempt. This could lead to a hang during a later IO.select call because no more data was being sent over the socket but the request could not be processed because all the data hadn't been read from the engine. Changed read nonblock to repeatedly attempt to read from the engine until there is nothing more ready to read.
This commit is contained in:
parent
d6496632fd
commit
6e914cf02d
1 changed files with 10 additions and 2 deletions
|
@ -27,15 +27,23 @@ module Puma
|
|||
end
|
||||
end
|
||||
|
||||
def engine_read_all
|
||||
output = @engine.read
|
||||
while output and additional_output = @engine.read
|
||||
output << additional_output
|
||||
end
|
||||
output
|
||||
end
|
||||
|
||||
def read_nonblock(size)
|
||||
while true
|
||||
output = @engine.read
|
||||
output = engine_read_all
|
||||
return output if output
|
||||
|
||||
data = @socket.read_nonblock(size)
|
||||
|
||||
@engine.inject(data)
|
||||
output = @engine.read
|
||||
output = engine_read_all
|
||||
|
||||
return output if output
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue