Skip to content

Commit

Permalink
Add test_client_quick_close_no_lowlevel_error_handler_call
Browse files Browse the repository at this point in the history
See puma#2390

Fixed by puma#2279

Fails in 5.0.2
  • Loading branch information
MSP-Greg committed Oct 14, 2020
1 parent 54f6911 commit c88f3c1
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/test_puma_server.rb
Expand Up @@ -1103,4 +1103,26 @@ def test_accept_econnaborted
stub_accept_nonblock(error)
assert_empty @events.stderr.string
end

# see https://github.com/puma/puma/issues/2390
# fixed by https://github.com/puma/puma/pull/2279
#
def test_client_quick_close_no_lowlevel_error_handler_call
handler = ->(err, env, status) {
@events.stdout.write "LLEH #{err.message}"
[500, {"Content-Type" => "application/json"}, ["{}\n"]]
}

@server = Puma::Server.new @app, @events, {:lowlevel_error_handler => handler}

server_run app: ->(env) { [200, {}, ['Hello World']] }

sock = TCPSocket.new @host, @port
# normal request doesn't generate EOFError
sock.syswrite "GET / HTTP"
sock.close

sleep 0.7 # need some delay for the lleh to be called
assert_empty @events.stdout.string
end
end

0 comments on commit c88f3c1

Please sign in to comment.