Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.0.2

Bug #18445 Response parsing fail if XML is on one line and hrefs contain the absolute URI
Submitted: 2011-04-14 15:27 UTC
From: cdujeu Assigned: doconnor
Status: Closed Package: HTTP_WebDAV_Client (version 1.0.1)
PHP Version: 5.3.1 OS: Windows
Roadmaps: (Not assigned)    

 [2011-04-14 15:27 UTC] cdujeu (Charles du Jeu)
Description: ------------ Hi, Just want to submit a patch that was necessary for me, trying to browse the content of a Java Content Repository through the WebDAV protocol. I'm not an expert in WebDAV, but checked the specification and it does not seem that JCR breaks the spec. What it does 1/ Send back the XML response on one unique line 2/ in the <D:href> tag, send back an absolute URI, containing the server host, protocole, etc. In such case, the parsing done in the dir_opendir() code of the HTTP_WebDAV_Client_Stream class does not correctly parse the items found inside a directory : 1/ As all is on one line, the preg_match() is only applied once and only the very first item is returned 2/ Content of D:href is compared to $this->path and not $this- >url, thus the current directory is returned as an item. Please find below my patch, for anyone interested. Was tested on this JCR response, but also on a more standard webDav response and it's working fine. Cheers Charles du Jeu


 [2011-04-14 15:30 UTC] cdujeu (Charles du Jeu)
 [2011-04-14 15:36 UTC] cdujeu (Charles du Jeu)
Sample XML response for testing : <?xml version="1.0" encoding="UTF-8"?><D:multistatus xmlns:D="DAV:"><D:response><D:href>http://localhost:7070/org.argeo.jcr.webapp/webdav/node/dev/home/root/</D:href><D:propstat><D:prop><D:creationdate>1970-01-01T00:00:00Z</D:creationdate><D:resourcetype><D:collection/></D:resourcetype><D:getlastmodified>Fri, 25 Feb 2011 14:56:49 GMT</D:getlastmodified></D:prop><D:status>HTTP/1.1 200 OK</D:status></D:propstat><D:propstat><D:prop><D:getcontentlength/></D:prop><D:status>HTTP/1.1 404 Not Found</D:status></D:propstat></D:response><D:response><D:href>http://localhost:7070/org.argeo.jcr.webapp/webdav/node/dev/home/root/Test/</D:href><D:propstat><D:prop><D:creationdate>1970-01-01T00:00:00Z</D:creationdate><D:resourcetype><D:collection/></D:resourcetype><D:getlastmodified>Fri, 25 Feb 2011 16:11:54 GMT</D:getlastmodified></D:prop><D:status>HTTP/1.1 200 OK</D:status></D:propstat><D:propstat><D:prop><D:getcontentlength/></D:prop><D:status>HTTP/1.1 404 Not Found</D:status></D:propstat></D:response></D:multistatus>
 [2011-05-29 18:34 UTC] doconnor (Daniel O'Connor)
Thanks for the patch Charles
 [2011-05-29 18:34 UTC] doconnor (Daniel O'Connor)
-Assigned To: +Assigned To: hholzgra
 [2011-12-10 06:50 UTC] doconnor (Daniel O'Connor)
This one has been untouched for ~6 months, marking as unmaintained
 [2011-12-10 07:28 UTC] doconnor (Daniel O'Connor)
-Status: Assigned +Status: Closed
This bug has been fixed in SVN. If this was a documentation problem, the fix will appear on by the end of next Sunday (CET). If this was a problem with the website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.
 [2011-12-11 18:04 UTC] doconnor (Daniel O'Connor)
-Assigned To: hholzgra +Assigned To: doconnor