/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
// split name to namespace and name
splitName(aName);
// evaluate enums for namespace and name
maWebDAVNamespace = StrToWebDAVNamespace(maNamespace);
maWebDAVName = StrToWebDAVName(maName);
}
} // end of anonymous namespace
if(nLen)
{ // create new context (push)
mpContext = new WebDAVContext(mpContext, aName, xAttribs);
if(collectThisPropertyAsName())
{ // When collecting property names and parent is prop there is no need // to handle the content of this property deeper (evtl. preparations)
} else
{ switch(mpContext->getWebDAVNamespace())
{ default: // WebDAVNamespace_unknown, WebDAVNamespace_last or unhandled
{ break;
} case WebDAVNamespace_DAV:
{ switch(mpContext->getWebDAVName())
{ default: // WebDAVName_unknown, WebDAVName_last or unhandled
{ break;
} case WebDAVName_propstat:
{ // propstat start if(isCollectingProperties())
{ // reset maPropStatProperties
maPropStatProperties.clear();
} else
{ // when collecting properties reset maPropStatNames
maPropStatNames.clear();
} break;
} case WebDAVName_response:
{ // response start, reset Href and status and maResponseProperties
maHref.clear();
maStatus.clear();
if(mpContext && nLen)
{ if(collectThisPropertyAsName())
{ // name must be encoded as expected by createSerfPropName()
OUString const name(MakePropertyName(*mpContext));
maPropStatNames.emplace_back(name);
} else
{ switch(mpContext->getWebDAVNamespace())
{ default: // WebDAVNamespace_unknown, WebDAVNamespace_last or unhandled
{ break;
} case WebDAVNamespace_DAV:
{ switch(mpContext->getWebDAVName())
{ default: // WebDAVName_unknown, WebDAVName_last or unhandled
{ break;
} case WebDAVName_href:
{ // href end, save it if we have whitespace if(whitespaceIsAvailable())
{ // Sharepoint 2016 workaround: apparently // the result is an IRI (RFC 3987 possibly?) // so try to encode the non-ASCII chars // without changing anything else
maHref = ::rtl::Uri::encode(mpContext->getWhiteSpace(),
rtl_UriCharClassUric, rtl_UriEncodeKeepEscapes,
RTL_TEXTENCODING_UTF8);
} break;
} case WebDAVName_status:
{ // status end, save it if we have whitespace if(whitespaceIsAvailable())
{
maStatus = mpContext->getWhiteSpace();
} break;
} case WebDAVName_getlastmodified:
{ // getlastmodified end, safe if content is correct if(propertyIsReady())
{
http_dav_ucp::DAVPropertyValue aDAVPropertyValue;
aDAVPropertyValue.Name = "DAV:getlastmodified";
aDAVPropertyValue.Value <<= mpContext->getWhiteSpace();
maPropStatProperties.push_back(aDAVPropertyValue);
} break;
} case WebDAVName_creationdate:
{ // creationdate end, safe if content is correct if(propertyIsReady())
{
http_dav_ucp::DAVPropertyValue aDAVPropertyValue;
aDAVPropertyValue.Name = "DAV:creationdate";
aDAVPropertyValue.Value <<= mpContext->getWhiteSpace();
maPropStatProperties.push_back(aDAVPropertyValue);
} break;
} case WebDAVName_collection:
{ // collection end, check and set if(hasParent(WebDAVName_resourcetype))
{
mbResourceTypeCollection = true;
} break;
} case WebDAVName_resourcetype:
{ // resourcetype end, check for collection if(hasParent(WebDAVName_prop))
{
http_dav_ucp::DAVPropertyValue aDAVPropertyValue;
aDAVPropertyValue.Name = "DAV:resourcetype";
aDAVPropertyValue.Value <<= (mbResourceTypeCollection ? u"collection"_ustr : OUString());
maPropStatProperties.push_back(aDAVPropertyValue);
} break;
} case WebDAVName_getcontentlength:
{ // getcontentlength end, safe if content is correct if(propertyIsReady())
{
http_dav_ucp::DAVPropertyValue aDAVPropertyValue;
aDAVPropertyValue.Name = "DAV:getcontentlength";
aDAVPropertyValue.Value <<= mpContext->getWhiteSpace();
maPropStatProperties.push_back(aDAVPropertyValue);
} break;
} case WebDAVName_getcontenttype:
{ // getcontenttype end, safe if content is correct if(propertyIsReady())
{
http_dav_ucp::DAVPropertyValue aDAVPropertyValue;
aEntry.Scope = maLockScope;
aEntry.Type = maLockType;
maLockEntries.realloc(nLength + 1);
maLockEntries.getArray()[nLength] = aEntry;
} break;
} case WebDAVName_owner:
{
maLock.Owner <<= mpContext->getWhiteSpace(); break;
} case WebDAVName_timeout:
{ const OUString sTimeout(mpContext->getWhiteSpace()); if (sTimeout == "Infinite")
maLock.Timeout = -1; elseif (sTimeout.startsWith("Second-"))
maLock.Timeout = o3tl::toInt64(sTimeout.subView(7)); break;
} case WebDAVName_locktoken:
{ const OUString sLockToken(maHref);
SAL_WARN_IF(!sLockToken.startsWith("opaquelocktoken:"), "ucb.ucp.webdav", "Parser error: wrong 'locktoken' value."); const sal_Int32 nLength(maLock.LockTokens.getLength());
maLock.LockTokens.realloc(nLength+1);
maLock.LockTokens.getArray()[nLength] = sLockToken; break;
} case WebDAVName_exclusive:
{ // exclusive lockscope end if(hasParent(WebDAVName_lockscope))
{
maLockScope = ucb::LockScope_EXCLUSIVE;
mbLockScopeSet = true;
} break;
} case WebDAVName_shared:
{ // shared lockscope end if(hasParent(WebDAVName_lockscope))
{
maLockScope = ucb::LockScope_SHARED;
mbLockScopeSet = true;
} break;
} case WebDAVName_write:
{ // write locktype end if(hasParent(WebDAVName_locktype))
{
maLockType = ucb::LockType_WRITE;
mbLockTypeSet = true;
} break;
} case WebDAVName_depth:
{
OUString const chars(mpContext->getWhiteSpace()); if (chars == "0")
{
maLock.Depth = ucb::LockDepth_ZERO;
} elseif (chars == "1")
{
maLock.Depth = ucb::LockDepth_ONE;
} elseif (chars == "infinity")
{
maLock.Depth = ucb::LockDepth_INFINITY;
} break;
} case WebDAVName_activelock:
{
maLock.Type = maLockType;
maLock.Scope = maLockScope;
maResult_Lock.push_back(maLock); break;
} case WebDAVName_lockdiscovery:
{ // lockdiscovery may be requested via PROPFIND, // in addition to LOCK! so return it 2 ways if (isCollectingProperties())
{
http_dav_ucp::DAVPropertyValue aDAVPropertyValue;
aDAVPropertyValue.Name = "DAV:lockdiscovery";
aDAVPropertyValue.Value <<= ::comphelper::containerToSequence(maResult_Lock);
maPropStatProperties.push_back(aDAVPropertyValue);
} break;
} case WebDAVName_propstat:
{ // propstat end, check status if(maStatus.getLength())
{ if(maStatus == "HTTP/1.1 200 OK")
{ if(isCollectingProperties())
{ if(!maPropStatProperties.empty())
{ // append to maResponseProperties if okay
maResponseProperties.insert(maResponseProperties.end(), maPropStatProperties.begin(), maPropStatProperties.end());
}
} else
{ if(!maPropStatNames.empty())
{ // when collecting properties append to
maResponseNames.insert(maResponseNames.end(), maPropStatNames.begin(), maPropStatNames.end());
}
}
}
} break;
} case WebDAVName_response:
{ // response end if(maHref.getLength())
{ if(isCollectingProperties())
{ // create DAVResource when we have content if(!maResponseProperties.empty())
{
http_dav_ucp::DAVResource aDAVResource;
aDAVResource.uri = maHref;
aDAVResource.properties = maResponseProperties;
maResult_PropFind.push_back(aDAVResource);
}
} else
{ // when collecting properties add them to result when there are some if(!maResponseNames.empty())
{
http_dav_ucp::DAVResourceInfo aDAVResourceInfo;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.