propertyupdate error response contains extra set of angle brackets
As reported by mcrha on IRC:
When trying to update a readonly property (for testing), davical 1.1.4 / 1.1.4 returns a response that contains an extra angle bracket around the cannot-modify-protected-property tag:
curl -v -k --basic --user USER:PASS -X PROPPATCH -d @test.xml http://example.com/davical/caldav.php/USER/ --header 'Content-Type: text/xml; charset=utf-8'
test.xml:
<?xml version="1.0" encoding="UTF-8" ?><propertyupdate xmlns="DAV:"><set><prop><getlastmodified>123456</getlastmodified></prop></set></propertyupdate>
RESPONSE:
<?xml version="1.0" encoding="utf-8" ?>
<multistatus xmlns="DAV:">
<response>
<href>/davical/caldav.php/fschlich/</href>
<responsedescription>Einige Eigenschaften konnten nicht geÀndert werden.</responsedescription>
<propstat>
<prop>
<getlastmodified/>
</prop>
<status>HTTP/1.1 409 Conflict</status>
<responsedescription>Eigenschaft ist schreibgeschÃŒtzt</responsedescription>
<error>
<<cannot-modify-protected-property/>
/>
</error>
</propstat>
</response>
</multistatus>
Note the extra '<' and '/>' around the cannot-modify-protected-property tag. The issue may be specific to getlastmodified.
See also https://tools.ietf.org/html/rfc4918#section-16 (WebDAV, Precondition/Postcondition XML Elements) - this seems to suggest that cannot-modify-protected-property should be used with 403 Forbidden instead of 409 Conflict?
11:01 < mcrha> in /usr/share/davical/inc/caldav-PROPPATCH.php, there
is only one occurrence where
'cannot-modify-protected-property' is also in `new
XMLElement()` which is wrong on the first look
11:01 < mcrha> all other ~5 occurrences do not use new XMLElement()
when calling add_failure()
11:03 < mcrha> and yes, if I remove that new XMLProperty call around
that string, then it returns valid XML :)