celluloid / reel

UNMAINTAINED: See celluloid/celluloid#779 - Celluloid::IO-powered web server
https://celluloid.io
MIT License
596 stars 87 forks source link

Socket closed unexpectedly for chunked response with "Connection: close" request #112

Closed unakatsuo closed 10 years ago

unakatsuo commented 10 years ago

Reel::Connection#respond has not handled the response state correctly so that the socket was closed right after sending response headers when the request has Connection: close header. It works perfectly for keep-alive request though.

request = Reel::Connection.new(socket).request 
request.respond :ok, :transfer_encoding => :chunked

 #  "Reel::SocketError: closed stream" raised here.
 request << "Hello" 
 request << "World"
 request.finish_response
tarcieri commented 10 years ago

Looks good aside from the one nit about making #reset_request public

unakatsuo commented 10 years ago

my change is still lacking care for handling @request_stm's termination state of chunked response. #reset_request scope can be changed in follow up changes.

tarcieri commented 10 years ago

OK, I'll call this forward progress ;)