'Connection reset by peer' when replying before the end of POST data
Hi!
Short introduction: I am working on a simple "one-click" file
sharing web application specific focus on protecting users' privacy [1].
Thanks to Rainbows! it can work with big uploads without any request
buffering which is simply marvelous! :)
I am currently trying to implement a limit on the maximum uploaded file
size, not unlike what is already done by Rainbows::MaxBody.
Unfortunately, it looks like answering a request while the client is in
the middle of posting data is not supported that well by Rainbows!
Here is a minimal test case:
--- 8< --- config.ru ---------------------------------------------------
class InterruptTest
def call(env)
# HTTP 1.1 standard (and curl) needs this
/\A100-continue\z/i =~ env['HTTP_EXPECT'] and return [ 100, {}, [] ]
error = "Request entity too large!\n"
env['rack.input'].read 1000
Rainbows.sleep 1
[ 403, { 'Content-Type' => 'text/plain' }, [ error ] ]
end
end
run InterruptTest.new
(Continue reading)