Re: webDAV/CalDAV client class experience ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



- Adding the HTTP header "Accept: */*" made sure all read actions ( e.g.
GET, PROPFIND, REPORT) worked perfectly

This is interesting. The Accept header has to do with what media types
the browser will accept in return. I didn't think it had anything to
do with what operations the server/application accepts. Must go read
further....

I'll have to revoke this statement, as I can't reproduce it anymore.
I noticed the DaviCal didn't use it, bu the CURL call did - and yielded more ( = meaningfull) results.
But, as I said, can't reproduce it.

The thing I could reproduce was that, if the request was sent to the default port, AND this port was included in the "Host" header, both GET and PUT yielded HTTP 404.


Only problem remaining was that PUT still isn't possible - at least not with
one of the providers. Since I used a verbatim copy of a PUT action from the
RFC, I strongly suspect the problem to be with the provider.

You've no doubt considered this already, but it might be intentional
on the provider's part. I'm not up on all the webDAV/calDAV providers;
I imagine some of them might add in additional layers of auth
(including the NOWAI layer)  just to consider themselves more secure.

Yes I did, but the following arguments should negate that consideration:
- when running OPTIONS, PUT is included in the allowed HTTP methods
- the HTTP return code from the PUT command is 301, where a security issue would have yielded a code in the 400 range - I think the CalDAV spec does mention Basic auhentication, so it can't be anything more sophisticated - the other provider does respond as expected (though I agree, that is the weakest argument: expectations != specifications ) - the provider does allow sync'ing Sunbird, iCal, ... over CalDAV, and that works, even entering a new event (which is a PUT action). The Charles debugging proxy too shows that it's only Basic authentication that's going up - and succeeding


I'll add the code I used for the tests.
When looking for the configuration ( Calendar URL, ...), the search term "CalDAV <provider> Calendar Sunbird" always did the trick for me. ( I also had to modify the Davical client class a bit - make some protected members public for this test code to work)


if (1)
{
$url = "https://caldav.calendar.<provider1>.com/dav/ba_aerts/Calendar/tstCalDAV/" ; // make sure it ends in a '/' !
   $user = "<usrname1>@<provider1>.com" ;
   $pwd  = "*********1" ;
}
else
{
$url = "https://www.<provider2>.com/calendar/dav/<usrname2>@<provider2>.com/events/" ;
   $user = "<usrname2>@<provider2>.com" ;
   $pwd = "**********2" ;
}

/************************************
 * run OPTIONS test                 *
 ************************************/

$method = "OPTIONS" ;

$requestHeaders = Array("content-type" => "text/xml",
                        "Depth" => 1) ;

echo "<UL>\n" ;

echo "<LI>$method request:\n" ;
doCurlRequest($method, $url, $user, $pwd, "", $requestHeaders) ;
doCalDAVClientRequest($method, $url, $user, $pwd, "", $requestHeaders ) ;
echo "</LI> \n" ;

echo "\r\n<LI>=========================================================================</LI> \n" ;

/************************************
 * run PROPFIND test                *
 ************************************/

$method = "PROPFIND" ;
$body = <<<XML
<D:propfind xmlns:D="DAV:" xmlns:CS="http://calendarserver.org/ns/"; xmlns:C="urn:ietf:params:xml:ns:caldav">
	<D:prop>
		<D:resourcetype />
		<D:owner />
		<D:current-user-principal />
		<D:supported-report-set />
		<C:supported-calendar-component-set />
		<CS:getctag />
	</D:prop>
</D:propfind>
XML;

echo "<LI>$method request:\n" ;
doCurlRequest($method, $url, $user, $pwd, $body, $requestHeaders) ;
doCalDAVClientRequest($method, $url, $user, $pwd, $body, $requestHeaders ) ;

echo "</LI> \n" ;

echo "\r\n<LI>=========================================================================</LI> \n" ;

/************************************
 * run REPORT test                  *
 ************************************/

$method = "REPORT" ;
$body = <<<XML
<?xml version="1.0" encoding="utf-8" ?>
<C:calendar-query xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav">
     <D:prop>
       <C:calendar-data/>
       <D:getetag/>
     </D:prop>
     <C:filter>
       <C:comp-filter name="VCALENDAR">
         <C:comp-filter name="VEVENT">
           <C:time-range start="20130201T000001Z" end="20130228T000001Z"/>
         </C:comp-filter>
       </C:comp-filter>
     </C:filter>
</C:calendar-query>
XML;

echo "<LI>$method request:\n" ;
doCurlRequest($method, $url, $user, $pwd, $body, $requestHeaders) ;
doCalDAVClientRequest($method, $url, $user, $pwd, $body, $requestHeaders ) ;
echo "</LI> \n" ;

echo "\r\n<LI>=========================================================================</LI> \n" ;

/************************************
 * run GET test                     *
 ************************************/

$method   = "GET" ;
$icsFile  = "e26443db-02d4-4bf0-a97c-c1ddbd3126df.ics" ;

echo "<LI>$method request:\n" ;

// some cheating required: check the *.ICS name of an existing
// resource in a previous REPORT run

doCurlRequest($method, $url . $icsFile, $user, $pwd, "", $requestHeaders) ;
doCalDAVClientRequest($method, $url . $icsFile, $user, $pwd, "", $requestHeaders) ;

echo "</LI> \n" ;

echo "\r\n<LI>=========================================================================</LI> \n" ;

/************************************
 * run PUT test                     *
 ************************************/

$method = "PUT" ;
$UID = "ABCDE" . time() ;
$url .= $UID . ".ICS" ;

$body = <<<ICAL
BEGIN:VCALENDAR
VERSION:2.0
PRODID:PHP heredoc
BEGIN:VEVENT
UID:$UID
SUMMARY:ingevoegd met PUT
DTSTAMP:20130215T123040
DTSTART:20130216T090000
DTEND:20130216T100000
END:VEVENT
END:VCALENDAR
ICAL;

echo "<LI>$method request:\n" ;

$requestHeaders = Array("If-none-match" => "*",
                        "Accept" => "*/*",
                        "content-type" => "text/calendar") ;


doCurlRequest($method, $url, $user, $pwd, $body, $requestHeaders) ;
doCalDAVClientRequest($method, $url, $user, $pwd, $body, $requestHeaders ) ;
echo "</LI> \n" ;

echo "\r\n<LI>=========================================================================</LI> \n" ;
echo "</UL> \n" ;

die ("End of test") ;




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux