benoitc/gunicorn — pull request #523 by paxan (2013-04-29 23:20:25+00:00)
Title: It's OK if the socket is closed by the client side.

This PR addresses issue #522.

The try-except around `sock.shutdown(...)` prevents worker exceptions like these:

```
2013-04-29T22:30:46.720Z ERROR N=gunicorn.error P=69755 Socket error processing request.
Traceback (most recent call last):
File ".../src/gunicorn/gunicorn/workers/async.py", line 45, in handle
self.handle_request(listener, req, client, addr)
File ".../src/gunicorn/gunicorn/workers/ggevent.py", line 119, in handle_request
super(GeventWorker, self).handle_request(*args)
File ".../src/gunicorn/gunicorn/workers/async.py", line 111, in handle_request
sock.shutdown(socket.SHUT_RDWR)
File ".../src/witness/lib/python2.7/site-packages/gevent-1.0rc2-py2.7-macosx-10.8-x86_64.egg/gevent/socket.py", line 517, in shutdown
self._sock.shutdown(how)
error: [Errno 57] Socket is not connected
```