aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/dav/lib/DAV/Xml
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2024-01-03 10:53:37 +0000
committerMario <mario@mariovavti.com>2024-01-03 10:53:37 +0000
commit322b619a7122fa812321ceb67016e0b1ce4affb6 (patch)
tree660fd384b04db56763d7bc2a18c1c18173f19f6e /vendor/sabre/dav/lib/DAV/Xml
parentdff906ca69efbb8ae18e9954ec7a937e36b50308 (diff)
downloadvolse-hubzilla-322b619a7122fa812321ceb67016e0b1ce4affb6.tar.gz
volse-hubzilla-322b619a7122fa812321ceb67016e0b1ce4affb6.tar.bz2
volse-hubzilla-322b619a7122fa812321ceb67016e0b1ce4affb6.zip
update sabre/dav
Diffstat (limited to 'vendor/sabre/dav/lib/DAV/Xml')
-rw-r--r--vendor/sabre/dav/lib/DAV/Xml/Element/Response.php46
-rw-r--r--vendor/sabre/dav/lib/DAV/Xml/Property/Href.php13
2 files changed, 43 insertions, 16 deletions
diff --git a/vendor/sabre/dav/lib/DAV/Xml/Element/Response.php b/vendor/sabre/dav/lib/DAV/Xml/Element/Response.php
index 79f06a09b..df9291465 100644
--- a/vendor/sabre/dav/lib/DAV/Xml/Element/Response.php
+++ b/vendor/sabre/dav/lib/DAV/Xml/Element/Response.php
@@ -40,7 +40,7 @@ class Response implements Element
*
* This is currently only used in WebDAV-Sync
*
- * @var string
+ * @var string|null
*/
protected $httpStatus;
@@ -112,13 +112,21 @@ class Response implements Element
*/
public function xmlSerialize(Writer $writer)
{
- if ($status = $this->getHTTPStatus()) {
- $writer->writeElement('{DAV:}status', 'HTTP/1.1 '.$status.' '.\Sabre\HTTP\Response::$statusCodes[$status]);
- }
+ /*
+ * Accordingly to the RFC the element looks like:
+ * <!ELEMENT response (href, ((href*, status)|(propstat+)), error?, responsedescription? , location?) >
+ *
+ * So the response
+ * - MUST contain a href and
+ * - EITHER a status and additional href(s)
+ * OR one or more propstat(s)
+ */
$writer->writeElement('{DAV:}href', $writer->contextUri.\Sabre\HTTP\encodePath($this->getHref()));
$empty = true;
+ $httpStatus = $this->getHTTPStatus();
+ // Add propstat elements
foreach ($this->getResponseProperties() as $status => $properties) {
// Skipping empty lists
if (!$properties || (!is_int($status) && !ctype_digit($status))) {
@@ -130,19 +138,25 @@ class Response implements Element
$writer->writeElement('{DAV:}status', 'HTTP/1.1 '.$status.' '.\Sabre\HTTP\Response::$statusCodes[$status]);
$writer->endElement(); // {DAV:}propstat
}
+
+ // The WebDAV spec only allows the status element on responses _without_ a propstat
if ($empty) {
- /*
- * The WebDAV spec _requires_ at least one DAV:propstat to appear for
- * every DAV:response. In some circumstances however, there are no
- * properties to encode.
- *
- * In those cases we MUST specify at least one DAV:propstat anyway, with
- * no properties.
- */
- $writer->writeElement('{DAV:}propstat', [
- '{DAV:}prop' => [],
- '{DAV:}status' => 'HTTP/1.1 418 '.\Sabre\HTTP\Response::$statusCodes[418],
- ]);
+ if (null !== $httpStatus) {
+ $writer->writeElement('{DAV:}status', 'HTTP/1.1 '.$httpStatus.' '.\Sabre\HTTP\Response::$statusCodes[$httpStatus]);
+ } else {
+ /*
+ * The WebDAV spec _requires_ at least one DAV:propstat to appear for
+ * every DAV:response if there is no status.
+ * In some circumstances however, there are no properties to encode.
+ *
+ * In those cases we MUST specify at least one DAV:propstat anyway, with
+ * no properties.
+ */
+ $writer->writeElement('{DAV:}propstat', [
+ '{DAV:}prop' => [],
+ '{DAV:}status' => 'HTTP/1.1 418 '.\Sabre\HTTP\Response::$statusCodes[418],
+ ]);
+ }
}
}
diff --git a/vendor/sabre/dav/lib/DAV/Xml/Property/Href.php b/vendor/sabre/dav/lib/DAV/Xml/Property/Href.php
index f88ce814a..d4e43da7c 100644
--- a/vendor/sabre/dav/lib/DAV/Xml/Property/Href.php
+++ b/vendor/sabre/dav/lib/DAV/Xml/Property/Href.php
@@ -35,6 +35,19 @@ class Href implements Element, HtmlOutput
protected $hrefs;
/**
+ * Automatically prefix the url with the server base directory.
+ * Note: use of this property in code was removed in PR:
+ * https://github.com/sabre-io/dav/pull/801
+ * But the property is left here because old data may still exist
+ * that has this property saved.
+ * See discussion in issue:
+ * https://github.com/sabre-io/Baikal/issues/1154.
+ *
+ * @var bool
+ */
+ protected $autoPrefix = true;
+
+ /**
* Constructor.
*
* You must either pass a string for a single href, or an array of hrefs.