
sf at apache
Nov 9, 2009, 1:04 PM
Post #1 of 1
(143 views)
Permalink
|
|
svn commit: r834230 - in /httpd/httpd/trunk: CHANGES modules/dav/main/mod_dav.c
|
|
Author: sf Date: Mon Nov 9 21:04:28 2009 New Revision: 834230 URL: http://svn.apache.org/viewvc?rev=834230&view=rev Log: Return 409 instead of 500 for a LOCK request if the parent resource does not exist or is not a collection. PR: 43465 Modified: httpd/httpd/trunk/CHANGES httpd/httpd/trunk/modules/dav/main/mod_dav.c Modified: httpd/httpd/trunk/CHANGES URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=834230&r1=834229&r2=834230&view=diff ============================================================================== --- httpd/httpd/trunk/CHANGES [utf-8] (original) +++ httpd/httpd/trunk/CHANGES [utf-8] Mon Nov 9 21:04:28 2009 @@ -10,6 +10,9 @@ mod_proxy_ftp: NULL pointer dereference on error paths. [Stefan Fritsch <sf fritsch.de>, Joe Orton] + *) mod_dav_fs; Return 409 instead of 500 for a LOCK request if the parent + resource does not exist or is not a collection. PR 43465. [Stefan Fritsch] + *) mod_dav_fs: Return 409 instead of 500 for Litmus test case copy_nodestcoll (a COPY request where the parent of the destination resource does not exist). PR 39299. [Stefan Fritsch] Modified: httpd/httpd/trunk/modules/dav/main/mod_dav.c URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/dav/main/mod_dav.c?rev=834230&r1=834229&r2=834230&view=diff ============================================================================== --- httpd/httpd/trunk/modules/dav/main/mod_dav.c (original) +++ httpd/httpd/trunk/modules/dav/main/mod_dav.c Mon Nov 9 21:04:28 2009 @@ -2995,6 +2995,7 @@ { dav_error *err; dav_resource *resource; + dav_resource *parent; const dav_hooks_locks *locks_hooks; int result; int depth; @@ -3026,6 +3027,20 @@ if (err != NULL) return dav_handle_err(r, err, NULL); + /* Check if parent collection exists */ + if ((err = resource->hooks->get_parent_resource(resource, &parent)) != NULL) { + /* ### add a higher-level description? */ + return dav_handle_err(r, err, NULL); + } + if (parent && (!parent->exists || parent->collection != 1)) { + err = dav_new_error(r->pool, HTTP_CONFLICT, 0, + apr_psprintf(r->pool, + "The parent resource of %s does not " + "exist or is not a collection.", + ap_escape_html(r->pool, r->uri))); + return dav_handle_err(r, err, NULL); + } + /* * Open writable. Unless an error occurs, we'll be * writing into the database.
|