diff ngx_http_catch_body_filter_module.c @ 2:04788ce8dae7

Close connection on errors.
author Maxim Dounin <mdounin@mdounin.ru>
date Mon, 09 Feb 2015 16:31:47 +0300
parents 5dcad7ad8eda
children
line wrap: on
line diff
--- a/ngx_http_catch_body_filter_module.c
+++ b/ngx_http_catch_body_filter_module.c
@@ -94,6 +94,16 @@ ngx_http_catch_body_filter(ngx_http_requ
             if (*p == 'X') {
                 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
                                "catch body: found");
+
+                /*
+                 * As we return NGX_HTTP_FORBIDDEN, the r->keepalive flag
+                 * won't be reset by ngx_http_special_response_handler().
+                 * Make sure to reset it to prevent processing of unread
+                 * parts of the request body.
+                 */
+
+                r->keepalive = 0;
+
                 return NGX_HTTP_FORBIDDEN;
             }
         }