aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/dav/lib/DAV/Server.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2020-01-12 09:18:07 +0000
committerMario <mario@mariovavti.com>2020-01-12 09:18:07 +0000
commit8cb968c4b03e5d5462edec56f31625e9f15a6a15 (patch)
treeccd1974ee57d17492a25846b2e4fae28b97c1e2f /vendor/sabre/dav/lib/DAV/Server.php
parentf645c6f3a57bf5f53bbb2bde362b2447f725c977 (diff)
downloadvolse-hubzilla-8cb968c4b03e5d5462edec56f31625e9f15a6a15.tar.gz
volse-hubzilla-8cb968c4b03e5d5462edec56f31625e9f15a6a15.tar.bz2
volse-hubzilla-8cb968c4b03e5d5462edec56f31625e9f15a6a15.zip
composer update sabre/dav
Diffstat (limited to 'vendor/sabre/dav/lib/DAV/Server.php')
-rw-r--r--vendor/sabre/dav/lib/DAV/Server.php36
1 files changed, 32 insertions, 4 deletions
diff --git a/vendor/sabre/dav/lib/DAV/Server.php b/vendor/sabre/dav/lib/DAV/Server.php
index 09760e9d1..69b3bb3f2 100644
--- a/vendor/sabre/dav/lib/DAV/Server.php
+++ b/vendor/sabre/dav/lib/DAV/Server.php
@@ -14,6 +14,7 @@ use Sabre\HTTP;
use Sabre\HTTP\RequestInterface;
use Sabre\HTTP\ResponseInterface;
use Sabre\Uri;
+use Sabre\Xml\Writer;
/**
* Main DAV server class.
@@ -185,6 +186,15 @@ class Server implements LoggerAwareInterface, EmitterInterface
public static $exposeVersion = true;
/**
+ * If this setting is turned on, any multi status response on any PROPFIND will be streamed to the output buffer.
+ * This will be beneficial for large result sets which will no longer consume a large amount of memory as well as
+ * send back data to the client earlier.
+ *
+ * @var bool
+ */
+ public static $streamMultiStatus = false;
+
+ /**
* Sets up the server.
*
* If a Sabre\DAV\Tree object is passed as an argument, it will
@@ -1628,19 +1638,38 @@ class Server implements LoggerAwareInterface, EmitterInterface
// {{{ XML Readers & Writers
/**
- * Generates a WebDAV propfind response body based on a list of nodes.
+ * Returns a callback generating a WebDAV propfind response body based on a list of nodes.
*
* If 'strip404s' is set to true, all 404 responses will be removed.
*
* @param array|\Traversable $fileProperties The list with nodes
* @param bool $strip404s
*
- * @return string
+ * @return callable|string
*/
public function generateMultiStatus($fileProperties, $strip404s = false)
{
$w = $this->xml->getWriter();
+ if (self::$streamMultiStatus) {
+ return function () use ($fileProperties, $strip404s, $w) {
+ $w->openUri('php://output');
+ $this->writeMultiStatus($w, $fileProperties, $strip404s);
+ $w->flush();
+ };
+ }
$w->openMemory();
+ $this->writeMultiStatus($w, $fileProperties, $strip404s);
+
+ return $w->outputMemory();
+ }
+
+ /**
+ * @param Writer $w
+ * @param $fileProperties
+ * @param bool $strip404s
+ */
+ private function writeMultiStatus(Writer $w, $fileProperties, bool $strip404s)
+ {
$w->contextUri = $this->baseUri;
$w->startDocument();
@@ -1662,7 +1691,6 @@ class Server implements LoggerAwareInterface, EmitterInterface
]);
}
$w->endElement();
-
- return $w->outputMemory();
+ $w->endDocument();
}
}