diff src/http/ngx_http_request_body.c @ 278:704622b2528a NGINX_0_5_9

nginx 0.5.9 *) Change: now the ngx_http_memcached_module uses the $memcached_key variable value as a key. *) Feature: the $memcached_key variable. *) Feature: the "clean" parameter in the "client_body_in_file_only" directive. *) Feature: the "env" directive. *) Feature: the "sendfile" directive is available inside the "if" block. *) Feature: now on failure of the writing to access nginx logs a message to error_log, but not more often than once a minute. *) Bugfix: the "access_log off" directive did not always turn off the logging.
author Igor Sysoev <http://sysoev.ru>
date Thu, 25 Jan 2007 00:00:00 +0300
parents c5c2b2883984
children 5bef04fc3fd5
line wrap: on
line diff
--- a/src/http/ngx_http_request_body.c
+++ b/src/http/ngx_http_request_body.c
@@ -14,7 +14,6 @@ static void ngx_http_read_client_request
 static ngx_int_t ngx_http_do_read_client_request_body(ngx_http_request_t *r);
 static ngx_int_t ngx_http_write_request_body(ngx_http_request_t *r,
     ngx_chain_t *body);
-static void ngx_http_finalize_request_body(ngx_http_request_t *r, ngx_int_t rc);
 static void ngx_http_read_discarded_body_handler(ngx_http_request_t *r);
 static ngx_int_t ngx_http_read_discarded_body(ngx_http_request_t *r);
 
@@ -72,6 +71,7 @@ ngx_http_read_client_request_body(ngx_ht
             tf->warn = "a client request body is buffered to a temporary file";
             tf->log_level = r->request_body_file_log_level;
             tf->persistent = r->request_body_in_persistent_file;
+            tf->clean = r->request_body_in_clean_file;
 
             if (r->request_body_file_group_access) {
                 tf->access = 0660;
@@ -80,7 +80,7 @@ ngx_http_read_client_request_body(ngx_ht
             rb->temp_file = tf;
 
             if (ngx_create_temp_file(&tf->file, tf->path, tf->pool,
-                                     tf->persistent, tf->access)
+                                     tf->persistent, tf->clean, tf->access)
                 != NGX_OK)
             {
                 return NGX_HTTP_INTERNAL_SERVER_ERROR;
@@ -238,14 +238,14 @@ ngx_http_read_client_request_body_handle
 
     if (r->connection->read->timedout) {
         r->connection->timedout = 1;
-        ngx_http_finalize_request_body(r, NGX_HTTP_REQUEST_TIME_OUT);
+        ngx_http_finalize_request(r, NGX_HTTP_REQUEST_TIME_OUT);
         return;
     }
 
     rc = ngx_http_do_read_client_request_body(r);
 
     if (rc >= NGX_HTTP_SPECIAL_RESPONSE) {
-        ngx_http_finalize_request_body(r, rc);
+        ngx_http_finalize_request(r, rc);
     }
 }
 
@@ -400,6 +400,7 @@ ngx_http_write_request_body(ngx_http_req
         tf->warn = "a client request body is buffered to a temporary file";
         tf->log_level = r->request_body_file_log_level;
         tf->persistent = r->request_body_in_persistent_file;
+        tf->clean = r->request_body_in_clean_file;
 
         if (r->request_body_file_group_access) {
             tf->access = 0660;
@@ -422,26 +423,6 @@ ngx_http_write_request_body(ngx_http_req
 }
 
 
-static void
-ngx_http_finalize_request_body(ngx_http_request_t *r, ngx_int_t rc)
-{
-    if (r->request_body->temp_file
-        && r->request_body_in_persistent_file
-        && r->request_body_delete_incomplete_file)
-    {
-        if (ngx_delete_file(r->request_body->temp_file->file.name.data)
-            == NGX_FILE_ERROR)
-        {
-            ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno,
-                          ngx_delete_file_n " \"%s\" failed",
-                          r->request_body->temp_file->file.name.data);
-        }
-    }
-
-    ngx_http_finalize_request(r, rc);
-}
-
-
 ngx_int_t
 ngx_http_discard_body(ngx_http_request_t *r)
 {