about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2012-04-27 11:48:16 -0700
committerEric Wong <normalperson@yhbt.net>2012-04-27 11:48:16 -0700
commit04901da5ae0b4655c83be05d24ae737f1b572002 (patch)
tree0cdf4f8772ab82a33eae232b368142910f018e0a
parent8c1aff1e6335f8a55723907e2661dcb09ea16205 (diff)
downloadunicorn-04901da5ae0b4655c83be05d24ae737f1b572002.tar.gz
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
-rw-r--r--lib/unicorn/http_server.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/unicorn/http_server.rb b/lib/unicorn/http_server.rb
index f942e2f..14a6f9a 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