]> git.kaiwu.me - nginx.git/commitdiff
Dav: fixed Location in successful MKCOL response.
authorRuslan Ermilov <ru@nginx.com>
Mon, 16 Dec 2019 12:19:01 +0000 (15:19 +0300)
committerRuslan Ermilov <ru@nginx.com>
Mon, 16 Dec 2019 12:19:01 +0000 (15:19 +0300)
Instead of reducing URI length to not include the terminating '\0'
character in 6ddaac3e0bf7, restore the terminating '/' character.

src/http/modules/ngx_http_dav_module.c

index 95c7b3299ebbf11dd49e852719e27992549f79ba..105a607ae8e8c3c4701539b31c3e55b2f32a1109 100644 (file)
@@ -513,7 +513,6 @@ ngx_http_dav_mkcol_handler(ngx_http_request_t *r, ngx_http_dav_loc_conf_t *dlcf)
     }
 
     *(p - 1) = '\0';
-    r->uri.len--;
 
     ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
                    "http mkcol path: \"%s\"", path.data);
@@ -521,6 +520,8 @@ ngx_http_dav_mkcol_handler(ngx_http_request_t *r, ngx_http_dav_loc_conf_t *dlcf)
     if (ngx_create_dir(path.data, ngx_dir_access(dlcf->access))
         != NGX_FILE_ERROR)
     {
+        *(p - 1) = '/';
+
         if (ngx_http_dav_location(r, path.data) != NGX_OK) {
             return NGX_HTTP_INTERNAL_SERVER_ERROR;
         }