httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brian J. France" <br...@brianfrance.com>
Subject DAV Resource Type Patch
Date Fri, 18 Sep 2009 14:01:27 GMT
Next up is the dav resource provider patch.

Currently there is no way to add additional resource type responses to  
mod_dav.  We are stuck with hard coded list from  
DAV_PROPID_resourcetype:

   http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/dav/main/std_liveprop.c?annotate=420983#l58

but with this patch:

   http://www.brianfrance.com/software/apache/dav/dav-resource-type-provider.diff

other modules can become providers and add resource types to the  
response.  This is needed because mod_dav_acl needs to add principal,  
mod_caldav needs to add calendar and mod_carddav needs to add  
addressbook resource types.

This patch (which should *not* be committed) extends the previous  
example mod_dav_acl to add the principal resource type:

   http://www.brianfrance.com/software/apache/dav/dav-resource-type-provider-acl.diff

Once patched and installed you can test it by adding the following to  
extra/httpd-dav.conf in the uploads Directory block:

     AuthType Digest
     AuthName DAV-upload

     AuthUserFile "<path to>/user.passwd"
     AuthDigestProvider file

creating a user.passwd file like this:

   % htdigest -c "<path to>/user.passwd" DAV-upload admin

starting apache and then doing a request like this:

% curl -v --digest --data-binary @resourcetype.txt --user admin \
     -H "Content-type: text/xml; charset=\"utf-8\"" \
     -H "Depth: 0" \
     -X 'PROPFIND' \
     http://localhost/uploads/index.html

where a file called resourcetype.txt is in the same directory with the  
following xml in it:

<?xml version="1.0" encoding="utf-8" ?>
<D:propfind xmlns:D="DAV:">
    <D:prop>
       <D:resourcetype/>
    </D:prop>
  </D:propfind>

and you should see a response that looks like this:

<?xml version="1.0" encoding="utf-8"?>
<D:multistatus xmlns:D="DAV:" xmlns:ns0="DAV:">
<D:response xmlns:lp1="DAV:">
<D:href>/uploads/index.html</D:href>
<D:propstat>
<D:prop>
<lp1:resourcetype><D:principal/></lp1:resourcetype>
</D:prop>
<D:status>HTTP/1.1 200 OK</D:status>
</D:propstat>
</D:response>
</D:multistatus>

The patches are based on Jari's httpd-2.2.8-ju.patch patch.  I have  
changed dav_hooks_resource to dav_resource_type_provider, based on  
previous comments on the options patch and also remove the ctx as it  
was not being used.

Comments, questions, problems?

Brian


Mime
View raw message