[nginx] Dav: added error logging.

Roman Arutyunyan arut at nginx.com
Wed Feb 7 13:49:02 UTC 2018


details:   http://hg.nginx.org/nginx/rev/573f20116163
branches:  
changeset: 7198:573f20116163
user:      Roman Arutyunyan <arut at nginx.com>
date:      Wed Feb 07 16:44:29 2018 +0300
description:
Dav: added error logging.

Previously, when request body was not available or was previously read in
memory rather than a file, client received HTTP 500 error, but no explanation
was logged in error log.  This could happen, for example, if request body was
read or discarded prior to error_page redirect, or if mirroring was enabled
along with dav.

diffstat:

 src/http/modules/ngx_http_dav_module.c |  11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diffs (21 lines):

diff -r ca8f8a443c11 -r 573f20116163 src/http/modules/ngx_http_dav_module.c
--- a/src/http/modules/ngx_http_dav_module.c	Tue Feb 06 20:02:59 2018 +0300
+++ b/src/http/modules/ngx_http_dav_module.c	Wed Feb 07 16:44:29 2018 +0300
@@ -213,7 +213,16 @@ ngx_http_dav_put_handler(ngx_http_reques
     ngx_ext_rename_file_t     ext;
     ngx_http_dav_loc_conf_t  *dlcf;
 
-    if (r->request_body == NULL || r->request_body->temp_file == NULL) {
+    if (r->request_body == NULL) {
+        ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
+                      "PUT request body is unavailable");
+        ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
+        return;
+    }
+
+    if (r->request_body->temp_file == NULL) {
+        ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
+                      "PUT request body must be in a file");
         ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
         return;
     }


More information about the nginx-devel mailing list