Mailing List Archive

External bind
Hey guys,

after getting the basics done, I'm looking into stuff for further extensions. One thing will be the subscription of external calendar sources (ICS, not CalDAV). So I found the wiki page about external binds:

http://wiki.davical.org/w/External_Bind

I added a DoBINDRequest() method to my version of caldav-client.php and can generate the request... that was the easy part, but I don't get how to use the BIND then. I looked into the code and found that he's using some "'/.external/'.md5($href)" container.

So how does this work together with the "BIND https://example.org/caldav.php/user/"? Can I query the collection under "https://example.org/caldav.php/user/.external/somemd5"?

Would be great to get some more insights on the topic... :D

Cheers
Matthias
_______________________________________________
DAViCal-dev mailing list
DAViCal-dev@lists.davical.org
http://lists.davical.org/listinfo/davical-dev
Re: External bind [ In reply to ]
On Wed, 2012-05-16 at 14:15 +0200, Matthias Althaus wrote:
> Hey guys,
>
> after getting the basics done, I'm looking into stuff for further
> extensions. One thing will be the subscription of external calendar
> sources (ICS, not CalDAV). So I found the wiki page about external
> binds:
>
> http://wiki.davical.org/w/External_Bind
>
> I added a DoBINDRequest() method to my version of caldav-client.php
> and can generate the request... that was the easy part, but I don't
> get how to use the BIND then. I looked into the code and found that
> he's using some "'/.external/'.md5($href)" container.

As I understand it the remote data is pulled into a local cache under
this URL, with the idea that if several people subscribe to the same
remote URL they all end up seeing the same single collection.


> So how does this work together with the "BIND
> https://example.org/caldav.php/user/"? Can I query the collection
> under "https://example.org/caldav.php/user/.external/somemd5"?

In general it should look like a normal collection to a CalDAV client,
though a read-only one.


> Would be great to get some more insights on the topic... :D

I don't use this myself, but there are some commits recently where
people have sent me some fixes for this functionality, so it looks
likely that Rob didn't consider everyone's circumstances originally :-)

Cheers,
Andrew.
--
------------------------------------------------------------------------
andrew (AT) morphoss (DOT) com +64(272)DEBIAN
The Killer Ducks are coming!!!
------------------------------------------------------------------------
Re: External bind [ In reply to ]
On May 16, 2012, at 9:30 PM, Andrew McMillan wrote:
> On Wed, 2012-05-16 at 14:15 +0200, Matthias Althaus wrote:
>> Hey guys,
>>
>> after getting the basics done, I'm looking into stuff for further
>> extensions. One thing will be the subscription of external calendar
>> sources (ICS, not CalDAV). So I found the wiki page about external
>> binds:
>>
>> http://wiki.davical.org/w/External_Bind
>>
>> I added a DoBINDRequest() method to my version of caldav-client.php
>> and can generate the request... that was the easy part, but I don't
>> get how to use the BIND then. I looked into the code and found that
>> he's using some "'/.external/'.md5($href)" container.
>
> As I understand it the remote data is pulled into a local cache under
> this URL, with the idea that if several people subscribe to the same
> remote URL they all end up seeing the same single collection.
>

Correct, for example, if 5 users on the same server all bind the exact same external url only one copy will be created in the database. Internally this is stored with a dav_name of /.external/ + MD5SUM of external url. Initially I did it that way so that importing the remote calendar, which is pretty intensive on the server side, didn't need to happen on every request to the bound collection.

All of the client interaction should be with the bound url which would be specified by the segment name. Slightly modified from the wiki:

BIND https://example.org/caldav.php/user/

<?xml version="1.0" encoding="utf-8"?>
<dav:bind xmlns:dav="DAV:">
<dav:segment>Rebels</dav:segment><dav:href>
http://www.me.com/ca/sharesubscribe/1.282129618/731F31CB-B333-43A7-9A79-78F785CDF767.ics</dav:href></dav:bind>

would create a new collection at

https://example.org/caldav.php/user/Rebels/


>
>> So how does this work together with the "BIND
>> https://example.org/caldav.php/user/"? Can I query the collection
>> under "https://example.org/caldav.php/user/.external/somemd5"?

No, you shouldn't ever see the /.external/ url's those should never be exposed to the client(via CALDAV), if you can than that's a bug.

>
> In general it should look like a normal collection to a CalDAV client,
> though a read-only one.
>

It's a little odd, but the contents are read-only, the properties are not, because the properties are on the binding not the remote contents.

>
>> Would be great to get some more insights on the topic... :D
>
> I don't use this myself, but there are some commits recently where
> people have sent me some fixes for this functionality, so it looks
> likely that Rob didn't consider everyone's circumstances originally :-)
>
> Cheers,
> Andrew.


Additionally, I recently discovered a race condition where the contents of the remote resource are never actually retrieved/stored. I'm working on fixing that as well as adding a few extra things that should add some flexibility for the future.

Hopefully that explains what currently happens.

Rob Ostensen
rob@boxacle.net





_______________________________________________
DAViCal-dev mailing list
DAViCal-dev@lists.davical.org
http://lists.davical.org/listinfo/davical-dev
Re: External bind [ In reply to ]
> would create a new collection at
> https://example.org/caldav.php/user/Rebels/

So the DAV:segment is simply the URL part after the user principal... that was the missing piece in my puzzle. :D

Thanks for the clearing. I'll play around with the feature and report any issues I stumble upon.

Cheers
Matthias
_______________________________________________
DAViCal-dev mailing list
DAViCal-dev@lists.davical.org
http://lists.davical.org/listinfo/davical-dev
Re: External bind [ In reply to ]
On Mon, 2012-05-21 at 12:05 +0200, Matthias Althaus wrote:
> > would create a new collection at
> > https://example.org/caldav.php/user/Rebels/
>
> So the DAV:segment is simply the URL part after the user principal...
> that was the missing piece in my puzzle. :D
>
> Thanks for the clearing. I'll play around with the feature and report
> any issues I stumble upon.

Yeah.

The terminology can be odd, at times. I think a lot of it comes from
the HTTP RFC, the URI RFC or the DAV RFC but there's been a specific
desire to use different words so that 'segment' is something like
'filename' but is not exactly the same, like 'principal' is something
like 'user', but not quite, 'collection' is something like 'folder' or
'directory', and 'resource' is something like 'file'.

Having the different terminology can be useful in stopping us all from
making assumptions about these things.

Cheers,
Andrew.

--
------------------------------------------------------------------------
andrew (AT) morphoss (DOT) com +64(272)DEBIAN
Don't be humble ... you're not that great.
-- Golda Meir
------------------------------------------------------------------------
Re: External bind [ In reply to ]
Hey Rob,

I've played around with the external binds some time and got it to work... after recognizing the bugs in 1.0.2 which made it not work. ;)

> Additionally, I recently discovered a race condition where the contents of the remote resource are never actually retrieved/stored. I'm working on fixing that as well as adding a few extra things that should add some flexibility for the future.

I dunno what you already know, but I've still an issue with the current code from the repo:

1) I send a bind request to the server. This gets stored fine and "modified" is set to the current timestamp.

2) I request the bound calendar and fetch_external is comparing the last modified time of the external file with the one in the database.

So in my case with external holidays updated somewhen 2010 it will never fetch the file. :(

Shouldn't be modified left empty to be able to handle the initial fetch?

In addition I don't understand the $min_age parameter of fetch_external(). I configured $c->external_refresh, but this isn't used in the call from update_external().

Cheers
Matthias
_______________________________________________
DAViCal-dev mailing list
DAViCal-dev@lists.davical.org
http://lists.davical.org/listinfo/davical-dev