diff options
| author | Igor Sysoev <igor@sysoev.ru> | 2008-01-03 19:13:04 +0000 |
|---|---|---|
| committer | Igor Sysoev <igor@sysoev.ru> | 2008-01-03 19:13:04 +0000 |
| commit | 369791a7df52c5b8b4ce3ee46750514d8c49b322 (patch) | |
| tree | 6065fc3c27ffa8b3a80d65629f78adba03e88ef6 /src/http/modules/ngx_http_dav_module.c | |
| parent | 284f0daa92c97650a15e3fe330a0c4742ba22a00 (diff) | |
| download | nginx-369791a7df52c5b8b4ce3ee46750514d8c49b322.tar.gz nginx-369791a7df52c5b8b4ce3ee46750514d8c49b322.tar.bz2 | |
change status code, add log message, and test collection URI
Diffstat (limited to 'src/http/modules/ngx_http_dav_module.c')
| -rw-r--r-- | src/http/modules/ngx_http_dav_module.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/http/modules/ngx_http_dav_module.c b/src/http/modules/ngx_http_dav_module.c index e83d32105..56dfb5f41 100644 --- a/src/http/modules/ngx_http_dav_module.c +++ b/src/http/modules/ngx_http_dav_module.c @@ -489,21 +489,25 @@ ngx_http_dav_delete_file(ngx_tree_ctx_t *ctx, ngx_str_t *path) static ngx_int_t ngx_http_dav_mkcol_handler(ngx_http_request_t *r, ngx_http_dav_loc_conf_t *dlcf) { + u_char *p; size_t root; - ngx_int_t rc; ngx_str_t path; if (r->headers_in.content_length_n > 0) { + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, + "MKCOL with body is unsupported"); return NGX_HTTP_UNSUPPORTED_MEDIA_TYPE; } - rc = ngx_http_discard_request_body(r); - - if (rc != NGX_OK) { - return rc; + if (r->uri.data[r->uri.len - 1] != '/') { + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, + "MKCOL can create a collection only"); + return NGX_HTTP_CONFLICT; } - ngx_http_map_uri_to_path(r, &path, &root, 0); + p = ngx_http_map_uri_to_path(r, &path, &root, 0); + + *(p - 1) = '\0'; ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "http mkcol path: \"%s\"", path.data); @@ -519,8 +523,7 @@ ngx_http_dav_mkcol_handler(ngx_http_request_t *r, ngx_http_dav_loc_conf_t *dlcf) } return ngx_http_dav_error(r->connection->log, ngx_errno, - NGX_HTTP_BAD_REQUEST, ngx_create_dir_n, - path.data); + NGX_HTTP_CONFLICT, ngx_create_dir_n, path.data); } |
