aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public/AppFramework/Http/Response.php
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2017-07-27 14:14:20 +0200
committerLukas Reschke <lukas@statuscode.ch>2017-07-27 14:17:45 +0200
commitf22ab3e665124e79427f51049fea0f937b66cdbb (patch)
treea2f4b3260853d0252b76d3ce452512a3f6a47ee6 /lib/public/AppFramework/Http/Response.php
parent63aa12e38c2e819b54c4b9e9632264a0e59dc6f2 (diff)
downloadnextcloud-server-f22ab3e665124e79427f51049fea0f937b66cdbb.tar.gz
nextcloud-server-f22ab3e665124e79427f51049fea0f937b66cdbb.zip
Add metadata to \OCP\AppFramework\Http\Response::throttle
Fixes https://github.com/nextcloud/server/issues/5891 Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
Diffstat (limited to 'lib/public/AppFramework/Http/Response.php')
-rw-r--r--lib/public/AppFramework/Http/Response.php16
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/public/AppFramework/Http/Response.php b/lib/public/AppFramework/Http/Response.php
index 087522386be..4e79e20a73f 100644
--- a/lib/public/AppFramework/Http/Response.php
+++ b/lib/public/AppFramework/Http/Response.php
@@ -83,6 +83,8 @@ class Response {
/** @var bool */
private $throttled = false;
+ /** @var array */
+ private $throttleMetadata = [];
/**
* Caches the response
@@ -328,10 +330,22 @@ class Response {
* Marks the response as to throttle. Will be throttled when the
* @BruteForceProtection annotation is added.
*
+ * @param array $metadata
* @since 12.0.0
*/
- public function throttle() {
+ public function throttle(array $metadata = []) {
$this->throttled = true;
+ $this->throttleMetadata = $metadata;
+ }
+
+ /**
+ * Returns the throttle metadata, defaults to empty array
+ *
+ * @return array
+ * @since 13.0.0
+ */
+ public function getThrottleMetadata() {
+ return $this->throttleMetadata;
}
/**