[PATCH 2 of 4] Fix aio sendfile unintentional usage

Maxim Dounin mdounin at mdounin.ru
Mon Oct 11 17:03:21 MSD 2010


# HG changeset patch
# User Maxim Dounin <mdounin at mdounin.ru>
# Date 1286639232 -14400
# Node ID df8478252f31d878b6dc0082a425c9398649df2b
# Parent  38a938ce08300bb57d0f6c885b1d8c35d602419d
Fix aio sendfile unintentional usage.

Always set c->aio_sendfile to make sure it will be cleared from previous
requests in the same connection.

Reported by:	Oleksandr V. Typlyns'kyi

diff --git a/src/http/ngx_http_copy_filter_module.c b/src/http/ngx_http_copy_filter_module.c
--- a/src/http/ngx_http_copy_filter_module.c
+++ b/src/http/ngx_http_copy_filter_module.c
@@ -118,8 +118,10 @@ ngx_http_copy_filter(ngx_http_request_t 
         ctx->filter_ctx = r;
 
 #if (NGX_HAVE_FILE_AIO)
-        if (ngx_file_aio && clcf->aio) {
-            ctx->aio_handler = ngx_http_copy_aio_handler;
+        if (ngx_file_aio) {
+            if (clcf->aio) {
+                ctx->aio_handler = ngx_http_copy_aio_handler;
+            }
 #if (NGX_HAVE_AIO_SENDFILE)
             c->aio_sendfile = (clcf->aio == NGX_HTTP_AIO_SENDFILE);
 #endif



More information about the nginx-devel mailing list