From 04901da5ae0b4655c83be05d24ae737f1b572002 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 27 Apr 2012 11:48:16 -0700 Subject: [PATCH] http_server: ignore ENOTCONN (mostly from shutdown(2)) Since there's nothing unicorn can do to avoid this error on unconnected/halfway-connected clients, ignoring ENOTCONN is a safe bet. Rainbows! has long had this rescue as it called getpeername(2) on untrusted sockets --- lib/unicorn/http_server.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/unicorn/http_server.rb b/lib/unicorn/http_server.rb index f942e2fe..14a6f9a0 100644 --- a/lib/unicorn/http_server.rb +++ b/lib/unicorn/http_server.rb @@ -507,7 +507,8 @@ class Unicorn::HttpServer # the socket is closed at the end of this function def handle_error(client, e) msg = case e - when EOFError,Errno::ECONNRESET,Errno::EPIPE,Errno::EINVAL,Errno::EBADF + when EOFError,Errno::ECONNRESET,Errno::EPIPE,Errno::EINVAL,Errno::EBADF, + Errno::ENOTCONN Unicorn::Const::ERROR_500_RESPONSE when Unicorn::RequestURITooLongError Unicorn::Const::ERROR_414_RESPONSE -- 2.11.4.GIT