Why is MKCOL favoured over MKCALENDAR ?

273 views
Skip to first unread message

B Aerts

unread,
Jan 16, 2015, 3:18:03 PM1/16/15
to sabredav...@googlegroups.com
Hello all,

new name on the list - a guy who's chosen the hard way to get acquainted with CalDAV : trial and error.

I had some severe headaches trying to perform a MKCALENDAR request against a Fruux account - while trying to solve it, I came across an older posting on this forum that said "Don't use MKCALENDAR, use MKCOL instead".

What's the reason for favouring MKCOL ?
Is that a spec-related reason, or an implementation reason ( in case SabreDAV) ?


( for those interested: yes, the MKCOL did indeed succeed, using most CalDAV settings properties ref. RFC4791 § 5.2 )

Evert Pot

unread,
Jan 16, 2015, 3:31:58 PM1/16/15
to sabredav...@googlegroups.com
On Friday, January 16, 2015 at 3:18:03 PM UTC-5, B Aerts wrote:
Hello all,

new name on the list - a guy who's chosen the hard way to get acquainted with CalDAV : trial and error.

I had some severe headaches trying to perform a MKCALENDAR request against a Fruux account - while trying to solve it, I came across an older posting on this forum that said "Don't use MKCALENDAR, use MKCOL instead".

What's the reason for favouring MKCOL ?
Is that a spec-related reason, or an implementation reason ( in case SabreDAV) ?

MKCALENDAR should just work. The only case I can think of when it doesn't, is if you use lighttpd, or otherwise your webserver may be specifically blocking HTTP methods it doesn't know.

So I'd be curious what you are getting back when you do the MKCALENDAR request.

I like MKCOL because it's more elegant in the wider 'DAV' world, but if you are a client developer who wants to target other caldav servers, MKCALENDAR might be more widely supported, and therefore better.

Evert

B Aerts

unread,
Jan 16, 2015, 4:05:44 PM1/16/15
to sabredav...@googlegroups.com


Hi Evert,

the error message was "Internal server error: trying  to get property of non-object".
The problem was incorrect formatting of a verbatim VTIMEZONE I used for the <c:calendar-timezone> property (a few whitespaces between the text and the EOL) .

Initially, my MKCOL worked, and MKCALENDAR failed.
Upon reading this forum, I replaced my MKCALENDAR ...<mkcalendar> body with a MKCOL....<mkcol> body - which subsequently failed too.
Was a good reminder to start stripping properties until the fault re-appeared - which was in the above-mentioned property

I'll send you the exact XML body in a few days if you want - I'm abroad right now, the erroneous code must be in my back-ups at home.
 
Greetings,

Bert

Evert Pot

unread,
Jan 16, 2015, 6:27:38 PM1/16/15
to sabredav...@googlegroups.com

I'd definitely be interested to take a peek =)

Evert

B Aerts

unread,
Jan 17, 2015, 3:22:46 PM1/17/15
to sabredav...@googlegroups.com

OK, *WRONG* request:

MKCALENDAR /calendars/<my-account>/querty/ HTTP/1.1
Authorization: Basic <sorry-classified>
User-Agent: PHP cURL Client
Host: dav.fruux.com
Accept: */*
Depth: 0
Content-type: application/xml
Content-Length: 1083
Expect: 100-continue



<?xml version='1.0' encoding='UTF-8' ?>
<C:mkcalendar xmlns:D='DAV:' xmlns:C='urn:ietf:params:xml:ns:caldav'>
   <D:set>
      <D:prop>
         <D:displayname>New Calendar</D:displayname>
         <C:calendar-timezone><![CDATA[BEGIN:VCALENDAR
BEGIN:VTIMEZONE 
TZID:Australia-Sydney
BEGIN:STANDARD 
TZNAME:Australia-Sydney Standard Time 
DTSTART:19700101T020000 
TZOFFSETFROM:+1000 
TZOFFSETTO:+1100 
RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU 
END:STANDARD 
BEGIN:DAYLIGHT 
TZNAME:Australia-Sydney Daylight Savings Time 
DTSTART:19700102T020000 
TZOFFSETFROM:+1100 
TZOFFSETTO:+1000 
RRULE:FREQ=YEARLY;BYMONTH=4;BYDAY=-1SU 
END:DAYLIGHT 
END:VTIMEZONE 
END:VCALENDAR
]]></C:calendar-timezone>
         <C:supported-calendar-data>text/calendar</C:supported-calendar-data>
         <C:min-date-time>19900815T205030Z</C:min-date-time>
         <C:max-date-time>20100815T205030Z</C:max-date-time>
         <C:supported-calendar-component-set>
            <C:comp name="VEVENT"/>
         </C:supported-calendar-component-set>
      </D:prop>
   </D:set>
</C:mkcalendar>
 
HTTP-Response:
HTTP/1.1 100 Continue
HTTP/1.1 401 Unauthorized
Content-Type: application/xml; charset=utf-8
Date: Sat, 17 Jan 2015 19:58:40 GMT
Server: nginx
WWW-Authenticate: Basic realm="Fruux"
X-Responding-Server: production-3
Content-Length: 298
Connection: keep-alive
HTTP/1.1 100 Continue
HTTP/1.1 500 Internal Server Error
Content-Type: application/xml; charset=utf-8
Date: Sat, 17 Jan 2015 19:58:41 GMT
Server: nginx
X-Responding-Server: production-1
X-Sabre-Version: 2.2.0-alpha1
Content-Length: 270
Connection: keep-alive
<?xml version='1.0' encoding='utf-8' ?>
<d:error xmlns:d='DAV:' xmlns:s='http://sabredav.org/ns'>
   <s:sabredav-version>2.2.0-alpha1</s:sabredav-version>
   <s:exception>ErrorException</s:exception>
   <s:message>Trying to get property of non-object</s:message>
</d:error>


Functional MKCOL code :
MKCOL /calendars/<my-account>/querty/ HTTP/1.1
Authorization: Basic <sorry-still-classified>
User-Agent: PHP cURL Client
Host: dav.fruux.com
Accept: */*
Content-type: application/xml
Content-Length: 1149
Expect: 100-continue



<?xml version='1.0' encoding='UTF-8' ?>
<D:mkcol xmlns:D='DAV:' xmlns:C='urn:ietf:params:xml:ns:caldav'>
   <D:set>
      <D:prop>
         <D:displayname>New Calendar</D:displayname>
         <C:calendar-timezone>BEGIN:VCALENDAR
BEGIN:VTIMEZONE
TZID:Europe-Brussels
BEGIN:STANDARD
TZNAME:Europe-Brussels Standard Time
DTSTART:19700101T020000
TZOFFSETFROM:+0200
TZOFFSETTO:+0100
RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU
END:STANDARD
BEGIN:DAYLIGHT
TZNAME:Europe-Brussels Daylight Savings Time
DTSTART:19700102T020000
TZOFFSETFROM:+0100
TZOFFSETTO:+0200
RRULE:FREQ=YEARLY;BYMONTH=4;BYDAY=-1SU
END:DAYLIGHT
END:VTIMEZONE
END:VCALENDAR
</C:calendar-timezone>
         <C:supported-calendar-data>text/calendar</C:supported-calendar-data>
         <C:min-date-time>19900815T205030Z</C:min-date-time>
         <C:max-date-time>20100815T205030Z</C:max-date-time>
         <D:resourcetype>
            <D:collection/>
            <C:calendar/>
         </D:resourcetype>
         <C:supported-calendar-component-set>
            <C:comp name="VEVENT"/>
         </C:supported-calendar-component-set>
      </D:prop>
   </D:set>
</D:mkcol>
HTTP-Response:
HTTP/1.1 100 Continue
HTTP/1.1 401 Unauthorized
Content-Type: application/xml; charset=utf-8
Date: Sat, 17 Jan 2015 20:12:21 GMT
Server: nginx
WWW-Authenticate: Basic realm="Fruux"
X-Responding-Server: production-3
Content-Length: 298
Connection: keep-alive
HTTP/1.1 100 Continue
HTTP/1.1 201 Created
Content-Type: text/html
Date: Sat, 17 Jan 2015 20:12:21 GMT
Server: nginx
Strict-Transport-Security: max-age=31536000
X-Responding-Server: production-3
X-Sabre-Version: 2.2.0-alpha1
Content-Length: 0
Connection: keep-alive


Functional MKCALENDAR code :
MKCALENDAR /calendars/<my-account>/querty/ HTTP/1.1
Authorization: Basic <gotcha-still-classified>
User-Agent: PHP cURL Client
Host: dav.fruux.com
Accept: */*
Content-type: application/xml
Content-Length: 1159
Expect: 100-continue



<?xml version='1.0' encoding='UTF-8' ?>
<C:mkcalendar xmlns:D='DAV:' xmlns:C='urn:ietf:params:xml:ns:caldav'>
   <D:set>
      <D:prop>
         <D:displayname>New Calendar</D:displayname>
         <C:calendar-timezone>BEGIN:VCALENDAR
BEGIN:VTIMEZONE
TZID:Europe-Brussels
BEGIN:STANDARD
TZNAME:Europe-Brussels Standard Time
DTSTART:19700101T020000
TZOFFSETFROM:+0200
TZOFFSETTO:+0100
RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU
END:STANDARD
BEGIN:DAYLIGHT
TZNAME:Europe-Brussels Daylight Savings Time
DTSTART:19700102T020000
TZOFFSETFROM:+0100
TZOFFSETTO:+0200
RRULE:FREQ=YEARLY;BYMONTH=4;BYDAY=-1SU
END:DAYLIGHT
END:VTIMEZONE
END:VCALENDAR
</C:calendar-timezone>
         <C:supported-calendar-data>text/calendar</C:supported-calendar-data>
         <C:min-date-time>19900815T205030Z</C:min-date-time>
         <C:max-date-time>20100815T205030Z</C:max-date-time>
         <D:resourcetype>
            <D:collection/>
            <C:calendar/>
         </D:resourcetype>
         <C:supported-calendar-component-set>
            <C:comp name="VEVENT"/>
         </C:supported-calendar-component-set>
      </D:prop>
   </D:set>
</C:mkcalendar>
HTTP-Response:
HTTP/1.1 100 Continue
HTTP/1.1 401 Unauthorized
Content-Type: application/xml; charset=utf-8
Date: Sat, 17 Jan 2015 20:18:14 GMT
Server: nginx
WWW-Authenticate: Basic realm="Fruux"
X-Responding-Server: production-3
Content-Length: 298
Connection: keep-alive
HTTP/1.1 100 Continue
HTTP/1.1 201 Created
Content-Type: text/html
Date: Sat, 17 Jan 2015 20:18:15 GMT
Server: nginx
Strict-Transport-Security: max-age=31536000
X-Responding-Server: production-1
X-Sabre-Version: 2.2.0-alpha1
Content-Length: 0
Connection: keep-alive

Not obvious to spot - but in the first (failing) request, there were some trailing whitespaces in the VTIMEZONE snippet (careless coding ...).
Once I removed these, both MKCOL and MKCALENDAR work.

Regards,

Bert
Reply all
Reply to author
Forward
0 new messages