|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
/** |
|
5
|
|
|
* @copyright Copyright (c) 2023 Joas Schilling <[email protected]> |
|
6
|
|
|
* |
|
7
|
|
|
* @author Joas Schilling <[email protected]> |
|
8
|
|
|
* |
|
9
|
|
|
* @license GNU AGPL version 3 or any later version |
|
10
|
|
|
* |
|
11
|
|
|
* This program is free software: you can redistribute it and/or modify |
|
12
|
|
|
* it under the terms of the GNU Affero General Public License as |
|
13
|
|
|
* published by the Free Software Foundation, either version 3 of the |
|
14
|
|
|
* License, or (at your option) any later version. |
|
15
|
|
|
* |
|
16
|
|
|
* This program is distributed in the hope that it will be useful, |
|
17
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
18
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
19
|
|
|
* GNU Affero General Public License for more details. |
|
20
|
|
|
* |
|
21
|
|
|
* You should have received a copy of the GNU Affero General Public License |
|
22
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
23
|
|
|
* |
|
24
|
|
|
*/ |
|
25
|
|
|
|
|
26
|
|
|
namespace OCA\DAV\Connector\Sabre\Exception; |
|
27
|
|
|
|
|
28
|
|
|
use DOMElement; |
|
29
|
|
|
use Sabre\DAV\Exception\NotAuthenticated; |
|
30
|
|
|
use Sabre\DAV\Server; |
|
31
|
|
|
|
|
32
|
|
|
class TooManyRequests extends NotAuthenticated { |
|
33
|
|
|
public const NS_OWNCLOUD = 'http://owncloud.org/ns'; |
|
34
|
|
|
|
|
35
|
|
|
public function getHTTPCode() { |
|
36
|
|
|
return 429; |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* This method allows the exception to include additional information |
|
41
|
|
|
* into the WebDAV error response |
|
42
|
|
|
* |
|
43
|
|
|
* @param Server $server |
|
44
|
|
|
* @param DOMElement $errorNode |
|
45
|
|
|
* @return void |
|
46
|
|
|
*/ |
|
47
|
|
|
public function serialize(Server $server, DOMElement $errorNode) { |
|
48
|
|
|
|
|
49
|
|
|
// set ownCloud namespace |
|
50
|
|
|
$errorNode->setAttribute('xmlns:o', self::NS_OWNCLOUD); |
|
51
|
|
|
|
|
52
|
|
|
$error = $errorNode->ownerDocument->createElementNS('o:', 'o:hint', 'too many requests'); |
|
|
|
|
|
|
53
|
|
|
$errorNode->appendChild($error); |
|
54
|
|
|
} |
|
55
|
|
|
} |
|
56
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.