/** * Serves PROPFIND requests. * * The method receives a {@link ezcWebdavPropFindRequest} object containing * all relevant information obout the clients request and will either * return an instance of {@link ezcWebdavErrorResponse} to indicate an error * or a {@link ezcWebdavPropFindResponse} on success. If the referenced * resource is a collection or if some properties produced errors, an * instance of {@link ezcWebdavMultistatusResponse} may be returned. * * The {@link ezcWebdavPropFindRequest} object contains a definition to * find one or more properties of a given collection or non-collection * resource. * * @param ezcWebdavPropFindRequest $request * @return ezcWebdavResponse */ public function propFind(ezcWebdavPropFindRequest $request) { $source = $request->requestUri; if (!ezcWebdavServer::getInstance()->isAuthorized($source, $request->getHeader('Authorization'))) { // Globally issue a 401, if the user does not have access to the // requested resource itself. return $this->createUnauthorizedResponse($source, $request->getHeader('Authorization')); // Multistatus with 403 will be issued for nested resources in the // specific methods. } // Check if resource is available if (!$this->nodeExists($source)) { return new ezcWebdavErrorResponse(ezcWebdavResponse::STATUS_404, $source); } // Verify If-[None-]Match headers $res = $this->checkIfMatchHeadersRecursive($request, $source, $request->getHeader('Depth')); if ($res !== null) { return $res; } // Check the exact type of propfind request and dispatch to // corresponding method. switch (true) { case $request->prop: return $this->fetchProperties($request); case $request->propName: return $this->fetchPropertyNames($request); case $request->allProp: return $this->fetchAllProperties($request); } // This should really never happen, because the request class itself // should have ensured, that on of those options is set. Untestable. return new ezcWebdavErrorResponse(ezcWebdavResponse::STATUS_500); }