]> git.kaiwu.me - nginx.git/commitdiff
Dav: added error logging.
authorRoman Arutyunyan <arut@nginx.com>
Wed, 7 Feb 2018 13:44:29 +0000 (16:44 +0300)
committerRoman Arutyunyan <arut@nginx.com>
Wed, 7 Feb 2018 13:44:29 +0000 (16:44 +0300)
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.

src/http/modules/ngx_http_dav_module.c

index 566b08ba19bd3121c13112f67d9ec64e98c73116..55ad9eb19b1f0ea99c41a30cfe44ee5a6cda5cdd 100644 (file)
@@ -213,7 +213,16 @@ ngx_http_dav_put_handler(ngx_http_request_t *r)
     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;
     }