/** * Process WebDAV HTTP request. * * @param void * @return void */ public function ProcessRequest() { /** @var CDavRequest $request */ $request = $this->request; $response = $this->response; if (strstr($request->GetParameter("REQUEST_URI"), '#')) { $response->SetHttpStatus("400 Bad Request"); $response->Render(); return; } $response->AddHeader("X-Dav-Powered-By: " . $this->davPoweredBy); // skip auth check for OPTIONS requests on "/" - http://pear.php.net/bugs/bug.php?id=5363 if (($request->GetParameter('REQUEST_METHOD') != 'OPTIONS' || $request->GetPath() != "/") && !$this->CheckAuthWrapper()) { $response->SetHttpStatus('401 Unauthorized'); $response->AddHeader('WWW-Authenticate: Basic realm="' . $this->davPoweredBy . '"'); if ($this instanceof CDavWebDavServer && CDav::isDigestEnabled() && COption::GetOptionString("main", "use_digest_auth", "N") == "Y") { // On first try we found that we don't know user digest hash. Let ask only Basic auth first. if ($_SESSION["BX_HTTP_DIGEST_ABSENT"] !== true) { $response->AddHeader('WWW-Authenticate: Digest realm="' . $this->davPoweredBy . '", nonce="' . uniqid() . '"'); } } $response->Render(); return; } if (!$this->CheckIfHeaderConditions()) { return; } $method = strtolower($request->GetParameter("REQUEST_METHOD")); $wrapper = $method . "Wrapper"; if ($method == "head" && !method_exists($this, "head")) { $method = "get"; } if (method_exists($this, $wrapper) && ($method == "options" || method_exists($this, $method))) { $this->{$wrapper}(); $response->Render(); } else { if ($request->GetParameter("REQUEST_METHOD") == "LOCK") { $error = '412 Precondition failed'; } else { $error = '405 Method not allowed'; $response->AddHeader("Allow: " . join(",", $this->GetAllowableMethods())); } $response->GenerateError($error); $response->Render(); } }