Hi Julian,
Before calling create collection hook Apache mod_dav code tries to get
it using a get_resource hook.
In case get_resource returns a resource with *exists* member being true,
apache dav does not call create collection hook and error out with
HTTP_METHOD_NOT_ALLOWED.
Reference from httpd-2.0.55/modules/dav/main/mod_dav.c
err = dav_get_resource(r, 0 /* label_allowed */, 0 /* use_checked_in */,
&resource);
if (err != NULL)
return dav_handle_err(r, err, NULL);
if (resource->exists) {
/* oops. something was already there! */
/* Apache will supply a default error for this. */
/* ### we should provide a specific error message! */
return HTTP_METHOD_NOT_ALLOWED;
}
Thanks,
With regards
Kamesh Jayachandran
Julian Foad wrote:
> Kamesh Jayachandran wrote:
>> Index: subversion/mod_dav_svn/repos.c
>> ===================================================================
>> --- subversion/mod_dav_svn/repos.c (revision 18117)
>> +++ subversion/mod_dav_svn/repos.c (working copy)
>> @@ -1544,6 +1544,14 @@
>> "trailing slash on the URI.");
>> }
>>
>> + if ((strcmp(r->method, "MKCOL") == 0) && comb->res.exists)
>> + {
>> + r->status_line = apr_pstrdup(r->pool, "409 Directory already
>> exists");
>> + return dav_new_error(r->pool, HTTP_CONFLICT,
>> + SVN_ERR_APMOD_DIRECTORY_EXISTS,
>> + "Directory already exists");
>> + }
>> +
>> *resource = &comb->res;
>> return NULL;
>
> No mention of the "r->method" nor "r->status_line" members nor any
> string comparison with a method name appears anywhere else in
> mod_dav_svn. This strikes me as odd, perhaps indicating that this is
> not the right way to detect and set such an error.
>
> Note that this code is within the "get resource" function, not within
> the "create collection" function. Perhaps if it is being called with
> a "MKCOL" method, it is being called wrongly.
>
> Disclaimer: I have no mod_dav_svn knowledge; these are just observations.
>
> - Julian
>
Received on Mon Jan 30 15:10:02 2006