Skip to content
This repository has been archived by the owner on Aug 12, 2019. It is now read-only.

Added PropertyStorage functionality #290

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nurtext
Copy link

@nurtext nurtext commented Sep 5, 2015

Allows "Me card" feature on OS X Address book.
Sadly not closing #289, sync still fails:

05.09.15 14:30:52,693 Contacts[8048]: [CardDAVPlugin-ERROR] -_handleCompletedAction: Error Domain=CoreDAVHTTPStatusErrorDomain Code=415 "Der Vorgang konnte nicht abgeschlossen werden. (CoreDAVHTTPStatusErrorDomain-Fehler 415.)" UserInfo=0x600000a6c380 {CoreDAVHTTPHeaders=<CFBasicHash 0x600000a6b940 [0x7fff7d4faed0]>{type = immutable dict, count = 7,
entries =>
    0 : Server = Apache
    1 : Content-Type = <CFString 0x6000002472c0 [0x7fff7d4faed0]>{contents = "application/xml; charset=utf-8"}
    2 : Vary = <CFString 0x60000025ad00 [0x7fff7d4faed0]>{contents = "Accept-Encoding"}
    6 : Date = <CFString 0x6000002461b0 [0x7fff7d4faed0]>{contents = "Sat, 05 Sep 2015 12:30:52 GMT"}
    8 : Content-Encoding = gzip
    11 : x-mod-spdy = <CFString 0x600000247110 [0x7fff7d4faed0]>{contents = "0.9.4.2-3a57358"}
    12 : x-sabre-version = 3.0.3
}
}

@nurtext
Copy link
Author

nurtext commented Sep 5, 2015

Traced down the error:

[2015-09-05T12:47:45+00:00] "Error while sending QUERY packet. PID=8159" vendor/sabre/dav/lib/CardDAV/Backend/PDO.php:538

Occurs when trying to import 132 contacts from my local address book. Will investigate further…

@Hywan
Copy link
Member

Hywan commented Sep 7, 2015

@nurtext I don't know this plugin very well so far. Maybe @evert can help?

@DominikTo
Copy link
Member

Maybe all that's missing is whitelisting a few paths with the pathFilter (see: http://sabre.io/dav/property-storage/).

Wanted to look into this, but on OS X 10.11 I couldn't set up a CardDAV account for katana at all. Contacts.app always tries to do PROPFINDs on /, /principals/ and /.well-known/carddav and doesn't prefix /server.php. Also couldn't make it work with BusyContacts. Maybe on 10.11 the only way is to set up proper URL rewriting.

@Hywan
Copy link
Member

Hywan commented Sep 7, 2015

@DominikTo Hmm, ok, it requires more work then.

@evert
Copy link
Member

evert commented Sep 7, 2015

@DominikTo did you try setting it up with the full principal url?

@DominikTo
Copy link
Member

@evert Yup, tried that, but on 10.11 Contacts.app always requests /, /principals/ and /.well-known/carddav regardless, which results in 405s (I think those are generated by Apache itself). That seems to cause the problem with Contacts.app.

But BusyContacts also doesn't properly bootstrap the account - with BusyContacts however I don't see any failed requests. It just stops and shows an "Unable to connect alert".

One thing I noticed is that BusyContacts tries to figure out addressbook-home-set on /server.php/principals/ (which isn't included in the response). Looks a bit like BusyContacts has trouble to find /server.php/principals/admin to request the addressbook-home-set there.

@DominikTo
Copy link
Member

@Hywan Setting up the pathFilter would be a quick fix - if I could test with a client. :-)

@evert
Copy link
Member

evert commented Sep 7, 2015

Did you try an extra slash behind admin? Can make all the difference (for both clients).

Also for both of them we might want to consider reporting bugs, because this might burn us in the future too...

@DominikTo
Copy link
Member

Full principal URL with a / at the end indeed helped with BusyContacts. Thanks! 👍

@nurtext
Copy link
Author

nurtext commented Sep 7, 2015

BTT: Seems one of my vCards was faulty. I now have all vCards imported and "Me card" feature works using the code from my PR. Is it going to be merged?

@DominikTo
Copy link
Member

Interesting that it's working for @nurtext. For me -at least with BusyContacts- setting the me-card doesn't result in anything getting stored in the property storage. Even with a pathFilter that just returns true for every path.

Request

PROPPATCH /server.php/addressbooks/admin/ HTTP/1.1
Host: sabre-katana.local
Content-Type: text/xml; charset=UTF-8
Accept-Encoding: gzip, deflate
Content-Length: 535
Connection: keep-alive
Accept: */*
User-Agent: BusyContacts-1.0.5
Authorization: Basic foo
Cache-Control: no-cache
Accept-Language: en-us

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<d:propertyupdate xmlns:d="DAV:" xmlns:a="urn:ietf:params:xml:ns:carddav" xmlns:b="http://calendarserver.org/ns/">
<d:set>
<d:prop>
<b:me-card>
<d:href>/server.php/addressbooks/admin/126668e3-8706-4a94-8b1c-c49749846de8/70C331B4-7D9F-428B-9D40-777BA2A4BD3A.vcf</d:href>
</b:me-card>
<a:principal-address>
<d:href>/server.php/addressbooks/admin/126668e3-8706-4a94-8b1c-c49749846de8/70C331B4-7D9F-428B-9D40-777BA2A4BD3A.vcf</d:href>
</a:principal-address>
</d:prop>
</d:set>
</d:propertyupdate>

Response

HTTP/1.1 207 Multi-Status
Date: Mon, 07 Sep 2015 13:36:17 GMT
Server: Apache/2.4.16 (Unix) PHP/5.5.27
X-Powered-By: PHP/5.5.27
X-Sabre-Version: 3.0.1
Vary: Brief,Prefer
Content-Length: 453
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: application/xml; charset=utf-8

<?xml version="1.0"?>
<d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:card="urn:ietf:params:xml:ns:carddav" xmlns:cal="urn:ietf:params:xml:ns:caldav" xmlns:cs="http://calendarserver.org/ns/">
 <d:response>
  <d:href>/server.php/addressbooks/admin</d:href>
  <d:propstat>
   <d:prop>
    <cs:me-card/>
    <card:principal-address/>
   </d:prop>
   <d:status>HTTP/1.1 200 OK</d:status>
  </d:propstat>
 </d:response>
</d:multistatus>

@evert
Copy link
Member

evert commented Sep 7, 2015

It should either have been set in propertystorage, or pathfilter would have caused it to return a 403. Are you looking at the right table and database @DominikTo ?

@DominikTo
Copy link
Member

Haha, yes. ;-) But no 403. Will check later by always returning false from the pathFilter.

@nurtext
Copy link
Author

nurtext commented Sep 7, 2015

Interesting: That "Error while sending QUERY packet" message seems to be an error with large MySQL inserts. Will try to raise max_allowed_packet. Seems none of my vCards was faulty but had large images embedded.

@evert
Copy link
Member

evert commented Sep 7, 2015

God I hate mysql for stuff like that :/

@nurtext
Copy link
Author

nurtext commented Sep 7, 2015

Yes, me too. But at least it has nothing to do with Katana itself, which is a good thing actually :)

@Hywan
Copy link
Member

Hywan commented Sep 8, 2015

@nurtext It can be related to sabre/katana because our schemas can not be well-designed :-/.

@evert
Copy link
Member

evert commented Oct 20, 2015

This will take a bit longer to integrate, because there's problems with sabre/katana's schema. Once #292 is integrated, this can be integrated too.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants