diff options
author | zotlabs <mike@macgirvin.com> | 2020-01-14 13:34:56 -0800 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2020-01-14 13:34:56 -0800 |
commit | 293d411efb28b8f20a0208e3c52883e9fbb8cea7 (patch) | |
tree | a8b0af66015815d56342daf8301ab5ae095eda0a /vendor/sabre/dav/lib/DAV | |
parent | 2a287e6def5ab54037222c963ab0875faf62fc1a (diff) | |
parent | d96f4340e80207a29a5c1c49cae8c25e3934d5ae (diff) | |
download | volse-hubzilla-293d411efb28b8f20a0208e3c52883e9fbb8cea7.tar.gz volse-hubzilla-293d411efb28b8f20a0208e3c52883e9fbb8cea7.tar.bz2 volse-hubzilla-293d411efb28b8f20a0208e3c52883e9fbb8cea7.zip |
Merge branch 'dev' of https://framagit.org/hubzilla/core into dev
Diffstat (limited to 'vendor/sabre/dav/lib/DAV')
-rw-r--r-- | vendor/sabre/dav/lib/DAV/Browser/GuessContentType.php | 10 | ||||
-rw-r--r-- | vendor/sabre/dav/lib/DAV/Server.php | 36 | ||||
-rw-r--r-- | vendor/sabre/dav/lib/DAV/Version.php | 2 |
3 files changed, 39 insertions, 9 deletions
diff --git a/vendor/sabre/dav/lib/DAV/Browser/GuessContentType.php b/vendor/sabre/dav/lib/DAV/Browser/GuessContentType.php index 7466babb3..b07103db9 100644 --- a/vendor/sabre/dav/lib/DAV/Browser/GuessContentType.php +++ b/vendor/sabre/dav/lib/DAV/Browser/GuessContentType.php @@ -85,10 +85,12 @@ class GuessContentType extends DAV\ServerPlugin */ protected function getContentType($fileName) { - // Just grabbing the extension - $extension = strtolower(substr($fileName, strrpos($fileName, '.') + 1)); - if (isset($this->extensionMap[$extension])) { - return $this->extensionMap[$extension]; + if (null !== $fileName) { + // Just grabbing the extension + $extension = strtolower(substr($fileName, strrpos($fileName, '.') + 1)); + if (isset($this->extensionMap[$extension])) { + return $this->extensionMap[$extension]; + } } return 'application/octet-stream'; 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(); } } diff --git a/vendor/sabre/dav/lib/DAV/Version.php b/vendor/sabre/dav/lib/DAV/Version.php index c00255881..bb48768a9 100644 --- a/vendor/sabre/dav/lib/DAV/Version.php +++ b/vendor/sabre/dav/lib/DAV/Version.php @@ -16,5 +16,5 @@ class Version /** * Full version number. */ - const VERSION = '4.0.2'; + const VERSION = '4.0.3'; } |