signalapp / Flock

Private contact and calendar sync for Android.
https://signal.org/blog/flock
358 stars 80 forks source link

Invaild XML body prevents connecton to SabreDAV #23

Open alxhrck opened 10 years ago

alxhrck commented 10 years ago

The error message is received when trying to connect to a SabreDAV server. The app stops testing the server setup on "DAV: edit collection properties. Server does not support creating DAV collection policies"

The following request and response were captured:

PROPPATCH /calendars/alex/delete-me/ HTTP/1.1
Keep-Alive: timeout=15
User-Agent: Jakarta Commons-HttpClient/3.1
Content-Length: 215
Content-Type: text/xml; charset=UTF-8
Authorization: Digest username="alex", realm="SabreDAV", nonce="53cf072cded5c", uri="/calendars/alex/delete-me/", response="fdd3cb48dc03a79f14f0253a19f1ebf6", qop=auth, nc=00000001, cnonce="82af66e6a22a09b46e68850a281e076b", opaque="df58bdff8cf60599c939187d0b5c54de"
Host: dav.host.net
Connection: close

<?xml version="1.0" encoding="UTF-8"?><D:propertyupdate xmlns:D="DAV:"><D:set><D:prop><X-TEST-XPROPERTIES xmlns="org.anhonesteffort.flock">TEST PROPERTY VALUE</X-TEST-XPROPERTIES></D:prop></D:set></D:propertyupdate>

RESPONSE:

HTTP/1.1 400 Bad request
Date: Wed, 23 Jul 2014 00:51:57 GMT
Server: Apache/2.4.9 (Amazon) PHP/5.4.30
X-Powered-By: PHP/5.4.30
Content-Length: 373
Connection: close
Content-Type: application/xml; charset=utf-8

<?xml version="1.0" encoding="utf-8"?>
<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
  <s:sabredav-version>2.0.3</s:sabredav-version>
  <s:exception>Sabre\DAV\Exception\BadRequest</s:exception>
  <s:message>The request body had an invalid XML body. (message: xmlns: URI org.anhonesteffort.flock is not absolute
, errorcode: 100, line: 1)</s:message>
</d:error>

Debugging help thanks to @evert

rhodey commented 10 years ago

@taiyed I was just able to reproduce this error while testing Flock compatability with OwnCloud which uses SabreDAV. Changing the namespace from "org.anhonesteffort.flock" to "http://org.anhonesteffort.flock/ns" seems to resolve the issue (ie no BAD REQUEST response).

Maybe this is all that's required to get Flock working with SabreDAV? I don't know, right now I'm trying to get OwnCloud happy-- will move to SabreDAV next, just thought I'd check in.

alxhrck commented 10 years ago

@rhodey I appreciate the response. Will this be added to the next update? If this change is included I can continue testing SabreDAV.

untitaker commented 9 years ago

XML namespaces are supposed to be absolute: https://en.wikipedia.org/wiki/XML_namespace#Namespace_declaration

SabreDAV is correct to reject this one.

gusennan commented 9 years ago

@rhodey Would addressing this by changing line 35 of OwsWebDav.java resolve the issue?