aboutsummaryrefslogtreecommitdiff
path: root/src/http/modules/proxy/ngx_http_proxy_cache.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2003-11-18 16:49:00 +0000
committerIgor Sysoev <igor@sysoev.ru>2003-11-18 16:49:00 +0000
commit222a2adf40eb25ff613c251f15032f1e39d7f609 (patch)
tree703e825cbfacdac4e1fdc73889371755bf5f68bb /src/http/modules/proxy/ngx_http_proxy_cache.c
parent0b2b4ccd2c8a31caea0ef760b55a63c2fc169838 (diff)
downloadnginx-222a2adf40eb25ff613c251f15032f1e39d7f609.tar.gz
nginx-222a2adf40eb25ff613c251f15032f1e39d7f609.zip
nginx-0.0.1-2003-11-18-19:49:00 import
Diffstat (limited to 'src/http/modules/proxy/ngx_http_proxy_cache.c')
-rw-r--r--src/http/modules/proxy/ngx_http_proxy_cache.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/http/modules/proxy/ngx_http_proxy_cache.c b/src/http/modules/proxy/ngx_http_proxy_cache.c
index 7c5ec595d..28ffde143 100644
--- a/src/http/modules/proxy/ngx_http_proxy_cache.c
+++ b/src/http/modules/proxy/ngx_http_proxy_cache.c
@@ -283,8 +283,28 @@ void ngx_http_proxy_cache_busy_lock(ngx_http_proxy_ctx_t *p)
p->cache->ctx.file.info_valid = 1;
}
-
if (rc == NGX_AGAIN) {
+
+ if ((ngx_event_flags & (NGX_USE_CLEAR_EVENT|NGX_HAVE_KQUEUE_EVENT))
+ && !p->request->connection->write->active)
+ {
+ /*
+ * kqueue allows to detect when client closes prematurely
+ * connection
+ */
+
+ p->request->connection->write->event_handler =
+ ngx_http_proxy_check_broken_connection;
+
+ if (ngx_add_event(p->request->connection->write, NGX_WRITE_EVENT,
+ NGX_CLEAR_EVENT) == NGX_ERROR)
+ {
+ ngx_http_proxy_finalize_request(p,
+ NGX_HTTP_INTERNAL_SERVER_ERROR);
+ return;
+ }
+ }
+
return;
}