Mailing List Archive

Perl Cal::DAV library and DAViCal 0.9.9
Hi! I'm trying to access a collection using the Perl Cal::DAV library and not
having a lot of success.

I've created a collection and imported a .ics file ok.

My perl code attempts to connect to caldav.php but I'm getting an
authorisation error. The code is:

#!/usr/bin/perl

use strict;
use warnings;


use Cal::DAV;
use Data::Dumper;

my $url = "http://localhost/davical/htdocs/caldav.php/Football/BarrowAFC/";
my $cal = Cal::DAV->new(url => $url, user => "admin", pass => "xxxxxx");

$cal->get;

print Dumper($cal);
======================

The Dumper() utility outputs:
======================
$VAR1 = bless( {
'url' =>
'http://localhost/davical/htdocs/caldav.php/Football/BarrowAFC/',
'_dav' => bless( {
'_lockedresourcelist' => bless( {
'_resources'
=> undef
},
'HTTP::DAV::ResourceList' ),
'_status' => 0,
'_message' => 'get
http://localhost/davical/htdocs/caldav.php/Football/BarrowAFC/ failed:
Unauthorized',
'_comms' => bless( {
'_last_request' =>
bless( {




However, if I change the URL in my code to public.php it works ok. So I've got
some sort of authorisation issue but I don't know what. I've checked access
rights of the collection by using Chandler and that's ok so my userid and
password is not incorrect.

Has DAViCal (caldav.php) been proved to work with Cal::DAV?

Thanks in advance!

--
Perl Cal::DAV library and DAViCal 0.9.9 [ In reply to ]
On Mon, 2010-07-12 at 18:57 +0100, Badzilla wrote:
> Hi! I'm trying to access a collection using the Perl Cal::DAV library and not
> having a lot of success.

>
> my $url = "http://localhost/davical/htdocs/caldav.php/Football/BarrowAFC/";
> my $cal = Cal::DAV->new(url => $url, user => "admin", pass => "xxxxxx");



> However, if I change the URL in my code to public.php it works ok. So I've got
> some sort of authorisation issue but I don't know what. I've checked access
> rights of the collection by using Chandler and that's ok so my userid and
> password is not incorrect.

You're using the 'admin' user, rather than the 'Football' user? But I
guess these work for you with Chandler, so they should work with this
also - ditto the URL, which seems a bit peculiar but I guess you might
have it set up that way.


> Has DAViCal (caldav.php) been proved to work with Cal::DAV?

No - I've never tried it here. I seem to recall someone mentioning a
problem with PUT, also - perhaps to do with it not sending a
Content-type header along with the request.

Cheers,
Andrew.
--
------------------------------------------------------------------------
andrew (AT) morphoss (DOT) com +64(272)DEBIAN
You will visit the Dung Pits of Glive soon.
------------------------------------------------------------------------

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.morphoss.com/pipermail/davical-users/attachments/20100712/40466a30/attachment.pgp>
-------------- next part --------------
Perl Cal::DAV library and DAViCal 0.9.9 [ In reply to ]
Hi Andrew - I've got to the bottom of this. The underlying HTTP::DAV library
called by Cal::DAV is broken at version 0.38. For confirmation,
http://www.perlmonks.org/?node_id=769896 and follow the links to the two
tickets.

This is the version with openSUSE 11.2 which I use.

To fix, upgrade to HTTP::DAV 0.40.

Cheers.

On Tuesday 13 Jul 2010 02:02:05 Andrew McMillan wrote:
> On Mon, 2010-07-12 at 18:57 +0100, Badzilla wrote:
> > Hi! I'm trying to access a collection using the Perl Cal::DAV library and
> > not having a lot of success.
> >
> >
> > my $url =
> > "http://localhost/davical/htdocs/caldav.php/Football/BarrowAFC/"; my $cal
> > = Cal::DAV->new(url => $url, user => "admin", pass => "xxxxxx");
> >
> >
> >
> > However, if I change the URL in my code to public.php it works ok. So
> > I've got some sort of authorisation issue but I don't know what. I've
> > checked access rights of the collection by using Chandler and that's ok
> > so my userid and password is not incorrect.
>
> You're using the 'admin' user, rather than the 'Football' user? But I
> guess these work for you with Chandler, so they should work with this
> also - ditto the URL, which seems a bit peculiar but I guess you might
> have it set up that way.
>
> > Has DAViCal (caldav.php) been proved to work with Cal::DAV?
>
> No - I've never tried it here. I seem to recall someone mentioning a
> problem with PUT, also - perhaps to do with it not sending a
> Content-type header along with the request.
>
> Cheers,
> Andrew.
>
Perl Cal::DAV library and DAViCal 0.9.9 [ In reply to ]
As a postscript - whilst the authentication was fixed with 0.4, I still could
not write back changes to the collection with the ->save method in Cal::DAV
which I believe is a wrapper for 'put' in HTTP::DAV. This could well chime
with your earlier comment about 'put' having problems.

As a workaround, I have abandoned the Perl development and I am now using the
Perl 'dave' command line webdav utility. Since I need to automate my work
which needs to delete all the events in a collection, then put a new set of
events in their place, I am also using the 'empty' command line stuffer
utility. FYI 'dave' works fine with DAViCal.

Strange, since that also uses HTTP::DAV. Maybe Cal::DAV is broken. It's
certainly poorly documented so perhaps my usage was incorrect. Any rate, I
would recommend 'dave' to anyone needing a command line client to work with
DAViCal, particularly since 'dave' can be automated with 'empty'.


On Tuesday 13 Jul 2010 11:09:27 Badzilla wrote:
> Hi Andrew - I've got to the bottom of this. The underlying HTTP::DAV
> library called by Cal::DAV is broken at version 0.38. For confirmation,
> http://www.perlmonks.org/?node_id=769896 and follow the links to the two
> tickets.
>
> This is the version with openSUSE 11.2 which I use.
>
> To fix, upgrade to HTTP::DAV 0.40.
>
> Cheers.
>
> On Tuesday 13 Jul 2010 02:02:05 Andrew McMillan wrote:
> > On Mon, 2010-07-12 at 18:57 +0100, Badzilla wrote:
> > > Hi! I'm trying to access a collection using the Perl Cal::DAV library
> > > and not having a lot of success.
> > >
> > >
> > > my $url =
> > > "http://localhost/davical/htdocs/caldav.php/Football/BarrowAFC/"; my
> > > $cal = Cal::DAV->new(url => $url, user => "admin", pass => "xxxxxx");
> > >
> > >
> > >
> > > However, if I change the URL in my code to public.php it works ok. So
> > > I've got some sort of authorisation issue but I don't know what. I've
> > > checked access rights of the collection by using Chandler and that's ok
> > > so my userid and password is not incorrect.
> >
> > You're using the 'admin' user, rather than the 'Football' user? But I
> > guess these work for you with Chandler, so they should work with this
> > also - ditto the URL, which seems a bit peculiar but I guess you might
> > have it set up that way.
> >
> > > Has DAViCal (caldav.php) been proved to work with Cal::DAV?
> >
> > No - I've never tried it here. I seem to recall someone mentioning a
> > problem with PUT, also - perhaps to do with it not sending a
> > Content-type header along with the request.
> >
> > Cheers,
> > Andrew.
>
> ---------------------------------------------------------------------------
> --- This SF.net email is sponsored by Sprint
> What will you do first with EVO, the first 4G phone?
> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> _______________________________________________
> rscds-general mailing list
> rscds-general at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rscds-general
>

--
Perl Cal::DAV library and DAViCal 0.9.9 [ In reply to ]
On Tue, 2010-07-13 at 16:42 +0100, Badzilla wrote:
> As a postscript - whilst the authentication was fixed with 0.4, I still could
> not write back changes to the collection with the ->save method in Cal::DAV
> which I believe is a wrapper for 'put' in HTTP::DAV. This could well chime
> with your earlier comment about 'put' having problems.

Can you add a header:

Content-type: text/calendar

to the PUT request? It is most likely this which is needed.


> As a workaround, I have abandoned the Perl development and I am now using the
> Perl 'dave' command line webdav utility. Since I need to automate my work
> which needs to delete all the events in a collection, then put a new set of
> events in their place, I am also using the 'empty' command line stuffer
> utility. FYI 'dave' works fine with DAViCal.
>
> Strange, since that also uses HTTP::DAV. Maybe Cal::DAV is broken. It's
> certainly poorly documented so perhaps my usage was incorrect. Any rate, I
> would recommend 'dave' to anyone needing a command line client to work with
> DAViCal, particularly since 'dave' can be automated with 'empty'.

It may be that 'dave' does some magic to set a correct Content-type
header on the request. Very likely HTTP::DAV does not do that by
default, and quite possibly Cal::DAV doesn't either.

I would tend to believe it's a bug for Cal::DAV not to do this, although
RFC 4791 does not explicitly say that a content-type header should be
provided. I'll try and relax this a bit in the next version, as it has
proved problematic not for the mainstream CalDAV clients, all of which
do provide a Content-type header, but for the quickly-hacked-together-
but-incredibly-useful script type of clients, such as yours.

Cheers,
Andrew.

>
>
> On Tuesday 13 Jul 2010 11:09:27 Badzilla wrote:
> > Hi Andrew - I've got to the bottom of this. The underlying HTTP::DAV
> > library called by Cal::DAV is broken at version 0.38. For confirmation,
> > http://www.perlmonks.org/?node_id=769896 and follow the links to the two
> > tickets.
> >
> > This is the version with openSUSE 11.2 which I use.
> >
> > To fix, upgrade to HTTP::DAV 0.40.
> >
> > Cheers.
> >
> > On Tuesday 13 Jul 2010 02:02:05 Andrew McMillan wrote:
> > > On Mon, 2010-07-12 at 18:57 +0100, Badzilla wrote:
> > > > Hi! I'm trying to access a collection using the Perl Cal::DAV library
> > > > and not having a lot of success.
> > > >
> > > >
> > > > my $url =
> > > > "http://localhost/davical/htdocs/caldav.php/Football/BarrowAFC/"; my
> > > > $cal = Cal::DAV->new(url => $url, user => "admin", pass => "xxxxxx");
> > > >
> > > >
> > > >
> > > > However, if I change the URL in my code to public.php it works ok. So
> > > > I've got some sort of authorisation issue but I don't know what. I've
> > > > checked access rights of the collection by using Chandler and that's ok
> > > > so my userid and password is not incorrect.
> > >
> > > You're using the 'admin' user, rather than the 'Football' user? But I
> > > guess these work for you with Chandler, so they should work with this
> > > also - ditto the URL, which seems a bit peculiar but I guess you might
> > > have it set up that way.
> > >
> > > > Has DAViCal (caldav.php) been proved to work with Cal::DAV?
> > >
> > > No - I've never tried it here. I seem to recall someone mentioning a
> > > problem with PUT, also - perhaps to do with it not sending a
> > > Content-type header along with the request.
> > >
> > > Cheers,
> > > Andrew.
> >
> > ---------------------------------------------------------------------------
> > --- This SF.net email is sponsored by Sprint
> > What will you do first with EVO, the first 4G phone?
> > Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> > _______________________________________________
> > rscds-general mailing list
> > rscds-general at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/rscds-general
> >
>

--
------------------------------------------------------------------------
andrew (AT) morphoss (DOT) com +64(272)DEBIAN
It is often easier to tame a wild idea than to breathe life into a
dull one. -- Alex Osborn

------------------------------------------------------------------------

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.morphoss.com/pipermail/davical-users/attachments/20100715/d7be69ea/attachment.pgp>
-------------- next part --------------