diff src/http/ngx_http_request.c @ 188:af37b7cb6698 NGINX_0_3_41

nginx 0.3.41 *) Feature: the -v switch. *) Bugfix: the segmentation fault may occurred if the SSI page has remote subrequests. *) Bugfix: in FastCGI handling. *) Bugfix: if the perl modules path was not set using --with-perl_modules_path=PATH or the "perl_modules", then the segmentation fault was occurred.
author Igor Sysoev <http://sysoev.ru>
date Fri, 21 Apr 2006 00:00:00 +0400
parents 54aabf2b0bc6
children 3689cd4e3228
line wrap: on
line diff
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -1218,7 +1218,9 @@ ngx_http_process_request_header(ngx_http
         }
     }
 
-    if (r->method == NGX_HTTP_POST && r->headers_in.content_length_n == -1) {
+    if (r->method & (NGX_HTTP_POST|NGX_HTTP_PUT)
+        && r->headers_in.content_length_n == -1)
+    {
         ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
                   "client sent POST method without \"Content-Length\" header");
         ngx_http_finalize_request(r, NGX_HTTP_LENGTH_REQUIRED);
@@ -1432,7 +1434,6 @@ ngx_http_finalize_request(ngx_http_reque
         }
 
         ngx_http_finalize_request(r, ngx_http_special_response_handler(r, rc));
-
         return;
     }
 
@@ -2154,19 +2155,11 @@ ngx_http_post_action(ngx_http_request_t 
 static void
 ngx_http_close_request(ngx_http_request_t *r, ngx_int_t error)
 {
-    ngx_connection_t    *c;
-    ngx_http_cleanup_t  *cln;
+    ngx_connection_t  *c;
 
     c = r->connection;
-    r = r->main;
-
-    for (cln = r->cleanup; cln; cln = cln->next) {
-        if (cln->handler) {
-            cln->handler(cln->data);
-        }
-    }
-
-    ngx_http_request_done(r, error);
+
+    ngx_http_request_done(r->main, error);
     ngx_http_close_connection(c);
 }
 
@@ -2177,6 +2170,7 @@ ngx_http_request_done(ngx_http_request_t
     ngx_log_t                  *log;
     ngx_uint_t                  i, n;
     struct linger               linger;
+    ngx_http_cleanup_t         *cln;
     ngx_http_log_ctx_t         *ctx;
     ngx_http_handler_pt        *log_handler;
     ngx_http_core_loc_conf_t   *clcf;
@@ -2191,6 +2185,12 @@ ngx_http_request_done(ngx_http_request_t
         return;
     }
 
+    for (cln = r->cleanup; cln; cln = cln->next) {
+        if (cln->handler) {
+            cln->handler(cln->data);
+        }
+    }
+
 #if (NGX_STAT_STUB)
 
     if (r->stat_reading) {