Subject: How to handle PROPFIND request with empty <prop> element?

From: Henrik Holst <[email-masked]>
Date: Tue, 25 Mar 2008 10:48:14 +0100

Hi,

 according to RFC4918 one should treat empty PROPFIND requests like an 
<allprop> request, but how should one handle a PROPFIND request which is 
not empty but have an empty <prop> element like:

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

Should this also be treated as an <allprop> request or should we reply 
with say "412 Precondition Failed" or some other error reply?

Sincerely yours, Henrik Holst

---

From: Julian Reschke <[email-masked]>
Date: Fri, 28 Mar 2008 20:03:32 +0100

> with say "412 Precondition Failed" or some other error reply?

It's invalid, as <prop> should contain a child element specifying the 
property.

Thus, it seems that status 422 makes sense.

Note that 412 has a very specific semantic that doesn't apply here.

And yes, it's unfortunate that there's no really simple way to just get 
the children of a collection; when I needed this, I usually asked for 
DAV:resourcetype, as this is known to exist on every resource, and 
should be cheap to compute.

BR, Julian

---

From: Simon Perreault <[email-masked]>
Date: Fri, 28 Mar 2008 15:29:22 -0400

> It's invalid, as <prop> should contain a child element specifying the

Did you find any text supporting that? Here's the DTD excerpt:

   <!ELEMENT prop ANY >

The XML spec isn't very clear on whether ANY may match an empty tag or not. I 
couldn't find out for sure, but I would expect that it may.

---

From: Julian Reschke <[email-masked]>
Date: Sun, 30 Mar 2008 11:24:58 +0200

> couldn't find out for sure, but I would expect that it may.

No, the DTD can't express the constraint.

But consider:

"Request particular property values, by naming the properties desired 
within the 'prop' element (the ordering of properties in here MAY be 
ignored by the server)," -- 
<http://greenbytes.de/tech/webdav/rfc4918.html#rfc.section.9.1>

and

"Contains properties related to a resource." -- 
<http://greenbytes.de/tech/webdav/rfc4918.html#rfc.section.14.18>

I'm pretty sure that there's code out there that will fail if <prop> is 
empty.

BR, Julian

---

From: Simon Perreault <[email-masked]>
Date: Sun, 30 Mar 2008 07:58:48 -0400

> I'm pretty sure that there's code out there that will fail if <prop> is

I was just wondering if there was a use case for a PROPFIND on no properties 
at all (i.e. not having an empty PROPFIND behave as if <allprop/> had been 
specified). I guess not...

---

From: Julian Reschke <[email-masked]>
Date: Sun, 30 Mar 2008 14:32:38 +0200

> specified). I guess not...

Well, there is: when you really want to only list the collection 
membership, but not any properties of the members.

BR, Julian