Opened 12 years ago
Last modified 3 years ago
#320 accepted enhancement
nginx should reliably check client connection close with pending data — at Version 1
Reported by: | Sergey Kandaurov | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | nginx-core | Version: | 1.3.x |
Keywords: | Cc: | ||
uname -a: | |||
nginx -V: | n/a |
Description (last modified by )
To detect if a connection was closed by a client, nginx uses:
- A EV_EOF flag as reported by kqueue. This only works if you use kqueue, i.e. on FreeBSD and friends.
- The recv(MSG_PEEK) call to test a case when connection was closed. This works on all platforms, but only if there are no pending data.
Most notably, this doesn't cover Linux and SSL connections, which are usually closed with pending data (a shutdown alert). To improve things, the following should be implemented (in no particular order):
- SSL_peek() for SSL connections instead of recv(MSG_PEEK), likely with additional c->peek() call.
- Support for EPOLLRDHUP, which is believed to be close to EV_EOF provided by kqueue.
References:
http://mailman.nginx.org/pipermail/nginx/2011-June/027669.html
http://mailman.nginx.org/pipermail/nginx/2011-November/030614.html
http://mailman.nginx.org/pipermail/nginx/2013-March/038119.html
Note:
See TracTickets
for help on using tickets.