aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2021-06-23 13:46:51 +0200
committerLukas Reschke <lukas@statuscode.ch>2021-06-23 13:58:47 +0200
commit25ab4059c6159fe8074af977e90d3b23ae648743 (patch)
tree017545053fa7eb4ad14985c0dbd2cfa0015cd559 /lib/public
parent3eee6e98ab444359e8d5c6055f9df81cd0732b10 (diff)
downloadnextcloud-server-25ab4059c6159fe8074af977e90d3b23ae648743.tar.gz
nextcloud-server-25ab4059c6159fe8074af977e90d3b23ae648743.zip
Add security.txt
Ref https://securitytxt.org Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
Diffstat (limited to 'lib/public')
-rw-r--r--lib/public/AppFramework/Http/TextPlainResponse.php62
1 files changed, 62 insertions, 0 deletions
diff --git a/lib/public/AppFramework/Http/TextPlainResponse.php b/lib/public/AppFramework/Http/TextPlainResponse.php
new file mode 100644
index 00000000000..93edf704863
--- /dev/null
+++ b/lib/public/AppFramework/Http/TextPlainResponse.php
@@ -0,0 +1,62 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * @copyright 2021 Lukas Reschke <lukas@statuscode.ch>
+ *
+ * @author 2021 Lukas Reschke <lukas@statuscode.ch>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+namespace OCP\AppFramework\Http;
+
+use OCP\AppFramework\Http;
+
+/**
+ * A renderer for text responses
+ * @since 22.0.0
+ */
+class TextPlainResponse extends Response {
+ /** @var string */
+ private $text = '';
+
+ /**
+ * constructor of TextPlainResponse
+ * @param string $text The text body
+ * @param int $statusCode the Http status code, defaults to 200
+ * @since 22.0.0
+ */
+ public function __construct(string $text = '', int $statusCode = Http::STATUS_OK) {
+ parent::__construct();
+
+ $this->text = $text;
+ $this->setStatus($statusCode);
+ $this->addHeader('Content-Type', 'text/plain');
+ }
+
+
+ /**
+ * Returns the text
+ * @return string
+ * @since 22.0.0
+ * @throws \Exception If data could not get encoded
+ */
+ public function render() : string {
+ return $this->text;
+ }
+}