Fix bugs in previous commit. Plus regression tests for it.

Signed-off-by: Andrew McMillan <andrew@morphoss.com>
This commit is contained in:
Andrew McMillan 2010-12-07 09:39:16 +13:00
parent 9b079d7549
commit ac190c7277
5 changed files with 96 additions and 2 deletions

View File

@ -20,7 +20,7 @@ $reply = new XMLDocument( array( 'DAV:' => '' ) );
if ( !isset($request->xml_tags) ) {
// Empty body indicates DAV::allprop request according to RFC4918
$property_list = 'DAV::allprop';
$property_list = array('DAV::allprop');
}
else {
$position = 0;
@ -41,7 +41,7 @@ else {
default: // prop, include
$subprop = $propwrap->GetElements();
foreach( $subprop AS $k => $v ) {
if ( is_object($v) && method_exists($v->GetTag()) ) $property_list[] = $v->GetTag();
if ( is_object($v) && method_exists($v,'GetTag') ) $property_list[] = $v->GetTag();
}
}
}

View File

@ -0,0 +1,13 @@
HTTP/1.1 400 Bad Request
Date: Dow, 01 Jan 2000 00:00:00 GMT
DAV: 1, 2, 3, access-control, calendar-access, calendar-schedule
DAV: extended-mkcol, calendar-proxy, bind, addressbook
Content-Location: /caldav.php/user1/home/
ETag: "567b0424ecca3303b030d882be2093ef"
Content-Length: 86
Content-Type: text/xml; charset="utf-8"
<?xml version="1.0" encoding="utf-8" ?>
<error xmlns="DAV:">
<invalid-xml/>
</error>

View File

@ -0,0 +1,19 @@
#
# Do a PROPFIND request with junk in the request
#
TYPE=PROPFIND
URL=http://mycaldav/caldav.php/user1/home
HEAD
HEADER=User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.7) Gecko/20061013 Thunderbird/1.5.0.7
HEADER=Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
HEADER=Accept-Language: en-us,en;q=0.5
HEADER=Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
HEADER=Content-Type: text/xml
HEADER=Depth: 0
BEGINDATA
<?xml version="1.0" encoding="utf-8" ?>
<D:propfind xmlns:D="DAV:"><D:allprops></D:propfind>
ENDDATA

View File

@ -0,0 +1,45 @@
HTTP/1.1 207 Multi-Status
Date: Dow, 01 Jan 2000 00:00:00 GMT
DAV: 1, 2, 3, access-control, calendar-access, calendar-schedule
DAV: extended-mkcol, calendar-proxy, bind, addressbook
Content-Location: /caldav.php/user1/home/
ETag: "55917ad4a56f1fab703fccc3c817fea5"
Content-Length: 943
Content-Type: text/xml; charset="utf-8"
<?xml version="1.0" encoding="utf-8" ?>
<multistatus xmlns="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav">
<response>
<href>/caldav.php/user1/home/</href>
<propstat>
<prop>
<getcontenttype>httpd/unix-directory</getcontenttype>
<resourcetype>
<collection/>
<C:calendar/>
</resourcetype>
<displayname>user1 home</displayname>
<getlastmodified>Dow, 01 Jan 2000 00:00:00 GMT</getlastmodified>
<creationdate>2009-06-03T00:00:00+12:00</creationdate>
<getcontentlanguage/>
<supportedlock>
<lockentry>
<lockscope>
<exclusive/>
</lockscope>
<locktype>
<write/>
</locktype>
</lockentry>
</supportedlock>
<owner>
<href>/caldav.php/user1/</href>
</owner>
<current-user-principal>
<href>/caldav.php/user1/</href>
</current-user-principal>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
</multistatus>

View File

@ -0,0 +1,17 @@
#
# Do a PROPFIND request with no content
# we continue to see this as a collection...
#
TYPE=PROPFIND
URL=http://mycaldav/caldav.php/user1/home
HEAD
HEADER=User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.7) Gecko/20061013 Thunderbird/1.5.0.7
HEADER=Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
HEADER=Accept-Language: en-us,en;q=0.5
HEADER=Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
HEADER=Depth: 0
BEGINDATA
ENDDATA