[Libreoffice-commits] core.git: Branch 'private/swe/libreoffice-5-2+backports' - 2 commits - include/tools officecfg/registry sysui/desktop tools/source ucb/CppunitTest_ucb_webdav_local_neon.mk ucb/Library_ucpdav1.mk ucb/source
Katarina Behrens
Katarina.Behrens at cib.de
Thu Feb 1 16:31:28 UTC 2018
include/tools/urlobj.hxx | 7 -
officecfg/registry/data/org/openoffice/ucb/Configuration.xcu | 23 +++
sysui/desktop/menus/base.desktop | 2
sysui/desktop/menus/calc.desktop | 2
sysui/desktop/menus/draw.desktop | 2
sysui/desktop/menus/impress.desktop | 2
sysui/desktop/menus/math.desktop | 2
sysui/desktop/menus/qstart.desktop | 2
sysui/desktop/menus/startcenter.desktop | 2
sysui/desktop/menus/writer.desktop | 2
sysui/desktop/menus/xsltfilter.desktop | 2
tools/source/fsys/urlobj.cxx | 33 ++++
ucb/CppunitTest_ucb_webdav_local_neon.mk | 1
ucb/Library_ucpdav1.mk | 1
ucb/source/ucp/webdav-neon/webdavcontent.cxx | 44 +++---
ucb/source/ucp/webdav-neon/webdavprovider.cxx | 75 ++---------
ucb/source/ucp/webdav-neon/webdavprovider.hxx | 25 +--
ucb/source/ucp/webdav/webdavcontent.cxx | 32 ++--
ucb/source/ucp/webdav/webdavprovider.cxx | 74 ++--------
ucb/source/ucp/webdav/webdavprovider.hxx | 25 +--
20 files changed, 163 insertions(+), 195 deletions(-)
New commits:
commit 7ae46b7cbb7148412b4093d8a1a419348459b991
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Tue Jan 30 11:45:19 2018 +0100
Pass also webdavs:// URLs directly to soffice binary
instead of going via kioexec & temp file
Change-Id: I48ed5de97a2914025f01884f5ed0d0edce452112
Reviewed-on: https://gerrit.libreoffice.org/48900
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>
(cherry picked from commit 2521401271820be9f42cb24e7dce12609e8f4686)
diff --git a/sysui/desktop/menus/base.desktop b/sysui/desktop/menus/base.desktop
index 06c3e7286de5..018542c07f34 100644
--- a/sysui/desktop/menus/base.desktop
+++ b/sysui/desktop/menus/base.desktop
@@ -31,7 +31,7 @@ X-GIO-NoFuse=true
Keywords=Data;SQL;
InitialPreference=5
StartupWMClass=libreoffice-base
-X-KDE-Protocols=file,http,ftp,webdav
+X-KDE-Protocols=file,http,ftp,webdav,webdavs
Actions=NewDocument;
[Desktop Action NewDocument]
diff --git a/sysui/desktop/menus/calc.desktop b/sysui/desktop/menus/calc.desktop
index a9240624e1be..0e4bc43a0071 100644
--- a/sysui/desktop/menus/calc.desktop
+++ b/sysui/desktop/menus/calc.desktop
@@ -31,7 +31,7 @@ X-GIO-NoFuse=true
Keywords=Accounting;Stats;OpenDocument Spreadsheet;Chart;Microsoft Excel;Microsoft Works;OpenOffice Calc;ods;xls;xlsx;
InitialPreference=5
StartupWMClass=libreoffice-calc
-X-KDE-Protocols=file,http,ftp,webdav
+X-KDE-Protocols=file,http,ftp,webdav,webdavs
Actions=NewDocument;
[Desktop Action NewDocument]
diff --git a/sysui/desktop/menus/draw.desktop b/sysui/desktop/menus/draw.desktop
index 39c6f0321c47..e0e38acf545f 100644
--- a/sysui/desktop/menus/draw.desktop
+++ b/sysui/desktop/menus/draw.desktop
@@ -31,7 +31,7 @@ X-GIO-NoFuse=true
Keywords=Vector;Schema;Diagram;Layout;OpenDocument Graphics;Microsoft Publisher;Microsoft Visio;Corel Draw;cdr;odg;svg;pdf;vsd;
InitialPreference=5
StartupWMClass=libreoffice-draw
-X-KDE-Protocols=file,http,ftp,webdav
+X-KDE-Protocols=file,http,ftp,webdav,webdavs
Actions=NewDocument;
[Desktop Action NewDocument]
diff --git a/sysui/desktop/menus/impress.desktop b/sysui/desktop/menus/impress.desktop
index e728eabe3490..585fba3faa23 100644
--- a/sysui/desktop/menus/impress.desktop
+++ b/sysui/desktop/menus/impress.desktop
@@ -31,7 +31,7 @@ X-GIO-NoFuse=true
Keywords=Slideshow;Slides;OpenDocument Presentation;Microsoft PowerPoint;Microsoft Works;OpenOffice Impress;odp;ppt;pptx;
InitialPreference=5
StartupWMClass=libreoffice-impress
-X-KDE-Protocols=file,http,ftp,webdav
+X-KDE-Protocols=file,http,ftp,webdav,webdavs
Actions=NewDocument;
[Desktop Action NewDocument]
diff --git a/sysui/desktop/menus/math.desktop b/sysui/desktop/menus/math.desktop
index 535a66925f14..37aa510f2bc4 100644
--- a/sysui/desktop/menus/math.desktop
+++ b/sysui/desktop/menus/math.desktop
@@ -32,7 +32,7 @@ X-GIO-NoFuse=true
Keywords=Equation;OpenDocument Formula;Formula;odf;MathML;
InitialPreference=5
StartupWMClass=libreoffice-math
-X-KDE-Protocols=file,http,ftp,webdav
+X-KDE-Protocols=file,http,ftp,webdav,webdavs
Actions=NewDocument;
[Desktop Action NewDocument]
diff --git a/sysui/desktop/menus/qstart.desktop b/sysui/desktop/menus/qstart.desktop
index ec4e9c2c067e..fc62b3215b8c 100644
--- a/sysui/desktop/menus/qstart.desktop
+++ b/sysui/desktop/menus/qstart.desktop
@@ -25,4 +25,4 @@ NoDisplay=true
Name=%PRODUCTNAME Quickstarter
Comment=Hook for quickstarter startup
X-GIO-NoFuse=true
-X-KDE-Protocols=file,http,ftp,webdav
+X-KDE-Protocols=file,http,ftp,webdav,webdavs
diff --git a/sysui/desktop/menus/startcenter.desktop b/sysui/desktop/menus/startcenter.desktop
index f0d2b63cd4ab..3551a750a45f 100644
--- a/sysui/desktop/menus/startcenter.desktop
+++ b/sysui/desktop/menus/startcenter.desktop
@@ -30,7 +30,7 @@ Comment=The office productivity suite compatible to the open and standardized OD
StartupNotify=true
X-GIO-NoFuse=true
StartupWMClass=libreoffice-startcenter
-X-KDE-Protocols=file,http,ftp,webdav
+X-KDE-Protocols=file,http,ftp,webdav,webdavs
##Define Actions
Actions=Writer;Calc;Impress;Draw;Base;Math;
diff --git a/sysui/desktop/menus/writer.desktop b/sysui/desktop/menus/writer.desktop
index 68ec858238df..bb679ed9b0cb 100644
--- a/sysui/desktop/menus/writer.desktop
+++ b/sysui/desktop/menus/writer.desktop
@@ -31,7 +31,7 @@ X-GIO-NoFuse=true
Keywords=Text;Letter;Fax;Document;OpenDocument Text;Microsoft Word;Microsoft Works;Lotus WordPro;OpenOffice Writer;CV;odt;doc;docx;rtf;
InitialPreference=5
StartupWMClass=libreoffice-writer
-X-KDE-Protocols=file,http,ftp,webdav
+X-KDE-Protocols=file,http,ftp,webdav,webdavs
Actions=NewDocument;
[Desktop Action NewDocument]
diff --git a/sysui/desktop/menus/xsltfilter.desktop b/sysui/desktop/menus/xsltfilter.desktop
index adea82a847c3..89a9eab98c2c 100644
--- a/sysui/desktop/menus/xsltfilter.desktop
+++ b/sysui/desktop/menus/xsltfilter.desktop
@@ -9,4 +9,4 @@ GenericName=XSLT based filters
NoDisplay=true
StartupNotify=true
X-GIO-NoFuse=true
-X-KDE-Protocols=file,http,ftp,webdav
+X-KDE-Protocols=file,http,ftp,webdav,webdavs
commit 06f5fe0aa579e31b9c0922f65267a61beae7df83
Author: Vasily Melenchuk <Vasily.Melenchuk at cib.de>
Date: Thu Jan 25 16:00:07 2018 +0300
Support for webdav:// and webdavs:// schemes from command line
We have currently support for WebDAV schemes as vnd.sun.star.webdav://
but it is not user and tools friendly.
Some related refactoring in ucb to reuse existing code instead of
manual parsing of URLs.
Reviewed-on: https://gerrit.libreoffice.org/48585
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>
(cherry picked from commit 65abd11d68ba9f849d89b98b6a56071411875c89)
Change-Id: Ib14411796d6cf11afd80d5132abe67d4e46a42e1
diff --git a/include/tools/urlobj.hxx b/include/tools/urlobj.hxx
index f5ee05110f18..02341f686395 100644
--- a/include/tools/urlobj.hxx
+++ b/include/tools/urlobj.hxx
@@ -53,6 +53,9 @@ enum class INetProtocol
File,
Mailto,
VndSunStarWebdav,
+ VndSunStarWebdavs,
+ Webdav,
+ Webdavs,
PrivSoffice,
VndSunStarHelp,
Https,
@@ -947,6 +950,7 @@ public:
static bool IsCaseSensitive() { return true; }
+ void changeScheme(INetProtocol eTargetScheme);
private:
// General Structure:
@@ -1153,9 +1157,6 @@ private:
TOOLS_DLLPRIVATE static bool scanIPv6reference(
sal_Unicode const *& rBegin, sal_Unicode const * pEnd);
-
-private:
- void changeScheme(INetProtocol eTargetScheme);
};
// static
diff --git a/officecfg/registry/data/org/openoffice/ucb/Configuration.xcu b/officecfg/registry/data/org/openoffice/ucb/Configuration.xcu
index ff38a798f2be..958202157838 100644
--- a/officecfg/registry/data/org/openoffice/ucb/Configuration.xcu
+++ b/officecfg/registry/data/org/openoffice/ucb/Configuration.xcu
@@ -67,6 +67,17 @@
<value/>
</prop>
</node>
+ <node oor:name="Provider4a" oor:op="replace" install:module="webdav">
+ <prop oor:name="ServiceName">
+ <value>com.sun.star.ucb.WebDAVContentProvider</value>
+ </prop>
+ <prop oor:name="URLTemplate">
+ <value>webdav</value>
+ </prop>
+ <prop oor:name="Arguments">
+ <value/>
+ </prop>
+ </node>
<node oor:name="Provider5" oor:op="replace">
<prop oor:name="ServiceName">
<value>com.sun.star.help.XMLHelp</value>
@@ -157,6 +168,18 @@
<value/>
</prop>
</node>
+ <node oor:name="Provider12b" oor:op="replace"
+ install:module="webdav">
+ <prop oor:name="ServiceName">
+ <value>com.sun.star.ucb.WebDAVContentProvider</value>
+ </prop>
+ <prop oor:name="URLTemplate">
+ <value>webdavs</value>
+ </prop>
+ <prop oor:name="Arguments">
+ <value/>
+ </prop>
+ </node>
<node oor:name="Provider14" oor:op="replace">
<prop oor:name="ServiceName">
<value>com.sun.star.ucb.ExtensionContentProvider</value>
diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx
index c31e61a429a1..c73317b6c1e9 100644
--- a/tools/source/fsys/urlobj.cxx
+++ b/tools/source/fsys/urlobj.cxx
@@ -332,6 +332,15 @@ INetURLObject::getSchemeInfo(INetProtocol eTheScheme)
"vnd.sun.star.webdav", "vnd.sun.star.webdav://", true, false,
false, false, true, true, true, true},
SchemeInfo{
+ "vnd.sun.star.webdavs", "vnd.sun.star.webdavs://", true, false,
+ false, false, true, true, true, true},
+ SchemeInfo{
+ "webdav", "webdav://", true, false, false, false, true, true,
+ true, true},
+ SchemeInfo{
+ "webdavs", "webdavs://", true, false, false, false, true, true,
+ true, true},
+ SchemeInfo{
"private", "private:", false, false, false, false, false, false,
false, true},
SchemeInfo{
@@ -1455,7 +1464,11 @@ bool INetURLObject::setAbsURIRef(OUString const & rTheAbsURIRef,
void INetURLObject::changeScheme(INetProtocol eTargetScheme) {
OUString aTmpStr=m_aAbsURIRef.makeStringAndClear();
- int oldSchemeLen=strlen(getSchemeInfo().m_pScheme);
+ int oldSchemeLen = 0;
+ if (m_eScheme == INetProtocol::Generic)
+ oldSchemeLen = m_aScheme.getLength();
+ else
+ oldSchemeLen = strlen(getSchemeInfo().m_pScheme);
m_eScheme=eTargetScheme;
int newSchemeLen=strlen(getSchemeInfo().m_pScheme);
m_aAbsURIRef.appendAscii(getSchemeInfo().m_pScheme);
@@ -2154,8 +2167,15 @@ INetURLObject::PrefixInfo const * INetURLObject::getPrefix(sal_Unicode const *&
{ "vnd.sun.star.tdoc:", nullptr, INetProtocol::VndSunStarTdoc,
PrefixInfo::OFFICIAL },
{ "vnd.sun.star.webdav:", nullptr, INetProtocol::VndSunStarWebdav,
- PrefixInfo::OFFICIAL } };
- /* This list needs to be sorted, or you'll introduce serious bugs */
+ PrefixInfo::OFFICIAL },
+ { "vnd.sun.star.webdavs:", nullptr, INetProtocol::VndSunStarWebdavs,
+ PrefixInfo::OFFICIAL },
+ { "webdav:", nullptr, INetProtocol::Webdav,
+ PrefixInfo::OFFICIAL },
+ { "webdavs:", nullptr, INetProtocol::Webdavs,
+ PrefixInfo::OFFICIAL }
+ };
+/* This list needs to be sorted, or you'll introduce serious bugs */
PrefixInfo const * pFirst = aMap + 1;
PrefixInfo const * pLast = aMap + sizeof aMap / sizeof (PrefixInfo) - 1;
@@ -2904,6 +2924,9 @@ bool INetURLObject::parsePath(INetProtocol eScheme,
case INetProtocol::Http:
case INetProtocol::VndSunStarWebdav:
+ case INetProtocol::VndSunStarWebdavs:
+ case INetProtocol::Webdav:
+ case INetProtocol::Webdavs:
case INetProtocol::Https:
case INetProtocol::Smb:
case INetProtocol::Cmis:
@@ -3869,7 +3892,9 @@ bool INetURLObject::isAnyKnownWebDAVScheme() const {
return ( isSchemeEqualTo( INetProtocol::Http ) ||
isSchemeEqualTo( INetProtocol::Https ) ||
isSchemeEqualTo( INetProtocol::VndSunStarWebdav ) ||
- isSchemeEqualTo( "vnd.sun.star.webdavs" ) );
+ isSchemeEqualTo( INetProtocol::VndSunStarWebdavs ) ||
+ isSchemeEqualTo( INetProtocol::Webdav ) ||
+ isSchemeEqualTo( INetProtocol::Webdavs ));
}
// static
diff --git a/ucb/CppunitTest_ucb_webdav_local_neon.mk b/ucb/CppunitTest_ucb_webdav_local_neon.mk
index 20e827b6868a..b37101090d98 100644
--- a/ucb/CppunitTest_ucb_webdav_local_neon.mk
+++ b/ucb/CppunitTest_ucb_webdav_local_neon.mk
@@ -24,6 +24,7 @@ $(eval $(call gb_CppunitTest_use_libraries,ucb_webdav_local_neon, \
salhelper \
test \
ucbhelper \
+ tl \
))
$(eval $(call gb_CppunitTest_use_library_objects,ucb_webdav_local_neon, \
diff --git a/ucb/Library_ucpdav1.mk b/ucb/Library_ucpdav1.mk
index 37f3c8f0af9c..4f1824a81051 100644
--- a/ucb/Library_ucpdav1.mk
+++ b/ucb/Library_ucpdav1.mk
@@ -21,6 +21,7 @@ $(eval $(call gb_Library_use_libraries,ucpdav1,\
sal \
salhelper \
ucbhelper \
+ tl \
$(gb_UWINAPI) \
))
diff --git a/ucb/source/ucp/webdav-neon/webdavcontent.cxx b/ucb/source/ucp/webdav-neon/webdavcontent.cxx
index f89a2fc9bde8..07b14d3cb807 100644
--- a/ucb/source/ucp/webdav-neon/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-neon/webdavcontent.cxx
@@ -2500,25 +2500,29 @@ void Content::transfer(
// Check source's and target's URL scheme
OUString aScheme = sourceURI.GetScheme().toAsciiLowerCase();
- if ( aScheme == WEBDAV_URL_SCHEME )
+ if ( aScheme == VNDSUNSTARWEBDAV_URL_SCHEME)
{
- sourceURI.SetScheme(
- HTTP_URL_SCHEME );
+ sourceURI.SetScheme( HTTP_URL_SCHEME );
}
- else if ( aScheme == WEBDAVS_URL_SCHEME )
+ else if ( aScheme == VNDSUNSTARWEBDAVS_URL_SCHEME)
{
- sourceURI.SetScheme(
- HTTPS_URL_SCHEME );
+ sourceURI.SetScheme( HTTPS_URL_SCHEME );
}
else if ( aScheme == DAV_URL_SCHEME )
{
- sourceURI.SetScheme(
- HTTP_URL_SCHEME );
+ sourceURI.SetScheme( HTTP_URL_SCHEME );
}
else if ( aScheme == DAVS_URL_SCHEME )
{
- sourceURI.SetScheme(
- HTTPS_URL_SCHEME );
+ sourceURI.SetScheme( HTTPS_URL_SCHEME );
+ }
+ else if ( aScheme == WEBDAV_URL_SCHEME )
+ {
+ sourceURI.SetScheme( HTTP_URL_SCHEME );
+ }
+ else if ( aScheme == WEBDAVS_URL_SCHEME )
+ {
+ sourceURI.SetScheme( HTTPS_URL_SCHEME );
}
else
{
@@ -2535,18 +2539,18 @@ void Content::transfer(
}
aScheme = targetURI.GetScheme().toAsciiLowerCase();
- if ( aScheme == WEBDAV_URL_SCHEME )
- targetURI.SetScheme(
- HTTP_URL_SCHEME );
- else if ( aScheme == WEBDAVS_URL_SCHEME )
- targetURI.SetScheme(
- HTTPS_URL_SCHEME );
+ if ( aScheme == VNDSUNSTARWEBDAV_URL_SCHEME)
+ targetURI.SetScheme( HTTP_URL_SCHEME );
+ else if ( aScheme == VNDSUNSTARWEBDAVS_URL_SCHEME)
+ targetURI.SetScheme( HTTPS_URL_SCHEME );
else if ( aScheme == DAV_URL_SCHEME )
- targetURI.SetScheme(
- HTTP_URL_SCHEME );
+ targetURI.SetScheme( HTTP_URL_SCHEME );
else if ( aScheme == DAVS_URL_SCHEME )
- targetURI.SetScheme(
- HTTPS_URL_SCHEME );
+ targetURI.SetScheme( HTTPS_URL_SCHEME );
+ else if ( aScheme == WEBDAV_URL_SCHEME )
+ targetURI.SetScheme( HTTP_URL_SCHEME );
+ else if ( aScheme == WEBDAVS_URL_SCHEME )
+ targetURI.SetScheme( HTTPS_URL_SCHEME );
// @@@ This implementation of 'transfer' only works
// if the source and target are located at same host.
diff --git a/ucb/source/ucp/webdav-neon/webdavprovider.cxx b/ucb/source/ucp/webdav-neon/webdavprovider.cxx
index be6b50406832..12bf6400e0ff 100644
--- a/ucb/source/ucp/webdav-neon/webdavprovider.cxx
+++ b/ucb/source/ucp/webdav-neon/webdavprovider.cxx
@@ -37,7 +37,8 @@
#include "webdavprovider.hxx"
#include "webdavcontent.hxx"
-#include "osl/mutex.hxx"
+#include <osl/mutex.hxx>
+#include <tools/urlobj.hxx>
using namespace com::sun::star;
using namespace webdav_ucp;
@@ -122,76 +123,34 @@ ContentProvider::queryContent(
uno::RuntimeException, std::exception )
{
// Check URL scheme...
+ INetURLObject aURL( Identifier->getContentIdentifier() );
- const OUString aScheme
- = Identifier->getContentProviderScheme().toAsciiLowerCase();
- if ( aScheme != HTTP_URL_SCHEME && aScheme != HTTPS_URL_SCHEME
- && aScheme != WEBDAV_URL_SCHEME && aScheme != WEBDAVS_URL_SCHEME
- && aScheme != DAV_URL_SCHEME && aScheme != DAVS_URL_SCHEME && aScheme != FTP_URL_SCHEME )
+ if ( aURL.isSchemeEqualTo( INetProtocol::NotValid ) )
throw ucb::IllegalIdentifierException();
- // Normalize URL and create new Id, if nessacary.
- OUString aURL = Identifier->getContentIdentifier();
-
- // At least: <scheme> + "://"
- if ( aURL.getLength() < ( aScheme.getLength() + 3 ) )
- throw ucb::IllegalIdentifierException();
-
- if ( aURL.copy( aScheme.getLength(), 3 ) != "://" )
+ if ( !aURL.isAnyKnownWebDAVScheme() )
throw ucb::IllegalIdentifierException();
uno::Reference< ucb::XContentIdentifier > xCanonicId;
- bool bNewId = false;
- if ( aScheme == WEBDAV_URL_SCHEME )
- {
- aURL = aURL.replaceAt( 0,
- WEBDAV_URL_SCHEME_LENGTH,
- HTTP_URL_SCHEME );
- bNewId = true;
- }
- else if ( aScheme == WEBDAVS_URL_SCHEME )
- {
- aURL = aURL.replaceAt( 0,
- WEBDAVS_URL_SCHEME_LENGTH,
- HTTPS_URL_SCHEME );
- bNewId = true;
- }
- else if ( aScheme == DAV_URL_SCHEME )
+ if (aURL.isSchemeEqualTo( INetProtocol::VndSunStarWebdav ) ||
+ aURL.isSchemeEqualTo(DAV_URL_SCHEME) ||
+ aURL.isSchemeEqualTo( INetProtocol::Webdav ) )
{
- aURL = aURL.replaceAt( 0,
- DAV_URL_SCHEME_LENGTH,
- HTTP_URL_SCHEME );
- bNewId = true;
+ aURL.changeScheme( INetProtocol::Http );
+ xCanonicId = new ::ucbhelper::ContentIdentifier( aURL.getExternalURL() );
}
- else if ( aScheme == DAVS_URL_SCHEME )
+ else if ( aURL.isSchemeEqualTo( INetProtocol::VndSunStarWebdavs ) ||
+ aURL.isSchemeEqualTo( DAVS_URL_SCHEME ) ||
+ aURL.isSchemeEqualTo( INetProtocol::Webdavs ))
{
- aURL = aURL.replaceAt( 0,
- DAVS_URL_SCHEME_LENGTH,
- HTTPS_URL_SCHEME );
- bNewId = true;
+ aURL.changeScheme( INetProtocol::Https );
+ xCanonicId = new ::ucbhelper::ContentIdentifier( aURL.getExternalURL() );
}
-
- sal_Int32 nPos = aURL.lastIndexOf( '/' );
- if ( nPos != aURL.getLength() - 1 )
- {
- // Find second slash in URL.
- nPos = aURL.indexOf( '/', aURL.indexOf( '/' ) + 1 );
- if ( nPos == -1 )
- throw ucb::IllegalIdentifierException();
-
- nPos = aURL.indexOf( '/', nPos + 1 );
- if ( nPos == -1 )
- {
- aURL += "/";
- bNewId = true;
- }
- }
-
- if ( bNewId )
- xCanonicId = new ::ucbhelper::ContentIdentifier( aURL );
else
+ {
xCanonicId = Identifier;
+ }
osl::MutexGuard aGuard( m_aMutex );
diff --git a/ucb/source/ucp/webdav-neon/webdavprovider.hxx b/ucb/source/ucp/webdav-neon/webdavprovider.hxx
index 60ba57d74c2f..6c034bad907c 100644
--- a/ucb/source/ucp/webdav-neon/webdavprovider.hxx
+++ b/ucb/source/ucp/webdav-neon/webdavprovider.hxx
@@ -46,28 +46,21 @@ namespace webdav_ucp {
// URL scheme. This is the scheme the provider will be able to create
// contents for. The UCB will select the provider ( i.e. in order to create
// contents ) according to this scheme.
-#define WEBDAV_URL_SCHEME "vnd.sun.star.webdav"
-#define WEBDAV_URL_SCHEME_LENGTH 19
-
-#define WEBDAVS_URL_SCHEME "vnd.sun.star.webdavs"
-#define WEBDAVS_URL_SCHEME_LENGTH 20
-
-#define HTTP_URL_SCHEME "http"
-
-#define HTTPS_URL_SCHEME "https"
-
-#define DAV_URL_SCHEME "dav"
-#define DAV_URL_SCHEME_LENGTH 3
-
-#define DAVS_URL_SCHEME "davs"
-#define DAVS_URL_SCHEME_LENGTH 4
+#define VNDSUNSTARWEBDAV_URL_SCHEME "vnd.sun.star.webdav"
+#define VNDSUNSTARWEBDAVS_URL_SCHEME "vnd.sun.star.webdavs"
+#define HTTP_URL_SCHEME "http"
+#define HTTPS_URL_SCHEME "https"
+#define DAV_URL_SCHEME "dav"
+#define DAVS_URL_SCHEME "davs"
+#define WEBDAV_URL_SCHEME "webdav"
+#define WEBDAVS_URL_SCHEME "webdavs"
#define FTP_URL_SCHEME "ftp"
#define HTTP_CONTENT_TYPE "application/" HTTP_URL_SCHEME "-content"
#define WEBDAV_CONTENT_TYPE HTTP_CONTENT_TYPE
-#define WEBDAV_COLLECTION_TYPE "application/" WEBDAV_URL_SCHEME "-collection"
+#define WEBDAV_COLLECTION_TYPE "application/" VNDSUNSTARWEBDAV_URL_SCHEME "-collection"
class ContentProvider : public ::ucbhelper::ContentProviderImplHelper
diff --git a/ucb/source/ucp/webdav/webdavcontent.cxx b/ucb/source/ucp/webdav/webdavcontent.cxx
index d549d7a3a1c6..a1490b5c279c 100644
--- a/ucb/source/ucp/webdav/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav/webdavcontent.cxx
@@ -2635,12 +2635,12 @@ void Content::transfer(
// Check source's and target's URL scheme
OUString aScheme = sourceURI.GetScheme().toAsciiLowerCase();
- if ( aScheme == WEBDAV_URL_SCHEME )
+ if ( aScheme == VNDSUNSTARWEBDAV_URL_SCHEME)
{
sourceURI.SetScheme(
OUString( HTTP_URL_SCHEME ) );
}
- else if ( aScheme == WEBDAVS_URL_SCHEME )
+ else if ( aScheme == VNDSUNSTARWEBDAVS_URL_SCHEME)
{
sourceURI.SetScheme(
OUString( HTTPS_URL_SCHEME ) );
@@ -2655,6 +2655,14 @@ void Content::transfer(
sourceURI.SetScheme(
OUString( HTTPS_URL_SCHEME ) );
}
+ else if (aScheme == WEBDAV_URL_SCHEME)
+ {
+ sourceURI.SetScheme(HTTP_URL_SCHEME);
+ }
+ else if (aScheme == WEBDAVS_URL_SCHEME)
+ {
+ sourceURI.SetScheme(HTTPS_URL_SCHEME);
+ }
else
{
if ( aScheme != HTTP_URL_SCHEME && aScheme != HTTPS_URL_SCHEME )
@@ -2670,18 +2678,18 @@ void Content::transfer(
}
aScheme = targetURI.GetScheme().toAsciiLowerCase();
- if ( aScheme == WEBDAV_URL_SCHEME )
- targetURI.SetScheme(
- OUString( HTTP_URL_SCHEME ) );
- else if ( aScheme == WEBDAVS_URL_SCHEME )
- targetURI.SetScheme(
- OUString( HTTPS_URL_SCHEME ) );
+ if ( aScheme == VNDSUNSTARWEBDAV_URL_SCHEME)
+ targetURI.SetScheme( HTTP_URL_SCHEME );
+ else if ( aScheme == VNDSUNSTARWEBDAVS_URL_SCHEME)
+ targetURI.SetScheme( HTTPS_URL_SCHEME );
else if ( aScheme == DAV_URL_SCHEME )
- targetURI.SetScheme(
- OUString( HTTP_URL_SCHEME ) );
+ targetURI.SetScheme( HTTP_URL_SCHEME );
else if ( aScheme == DAVS_URL_SCHEME )
- targetURI.SetScheme(
- OUString( HTTPS_URL_SCHEME ) );
+ targetURI.SetScheme( HTTPS_URL_SCHEME );
+ else if (aScheme == WEBDAV_URL_SCHEME)
+ targetURI.SetScheme(HTTP_URL_SCHEME);
+ else if (aScheme == WEBDAVS_URL_SCHEME)
+ targetURI.SetScheme(HTTPS_URL_SCHEME);
// @@@ This implementation of 'transfer' only works
// if the source and target are located at same host.
diff --git a/ucb/source/ucp/webdav/webdavprovider.cxx b/ucb/source/ucp/webdav/webdavprovider.cxx
index 27250824741e..dddbd2a45cfc 100644
--- a/ucb/source/ucp/webdav/webdavprovider.cxx
+++ b/ucb/source/ucp/webdav/webdavprovider.cxx
@@ -27,6 +27,8 @@
#include <com/sun/star/beans/NamedValue.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
+#include <tools/urlobj.hxx>
+
using namespace com::sun::star;
using namespace http_dav_ucp;
@@ -109,76 +111,34 @@ ContentProvider::queryContent(
uno::RuntimeException )
{
// Check URL scheme...
+ INetURLObject aURL(Identifier->getContentIdentifier());
- const OUString aScheme
- = Identifier->getContentProviderScheme().toAsciiLowerCase();
- if ( aScheme != HTTP_URL_SCHEME && aScheme != HTTPS_URL_SCHEME &&
- aScheme != WEBDAV_URL_SCHEME && aScheme != WEBDAVS_URL_SCHEME &&
- aScheme != DAV_URL_SCHEME && aScheme != DAVS_URL_SCHEME )
- throw ucb::IllegalIdentifierException();
-
- // Normalize URL and create new Id, if nessacary.
- OUString aURL = Identifier->getContentIdentifier();
-
- // At least: <scheme> + "://"
- if ( aURL.getLength() < ( aScheme.getLength() + 3 ) )
+ if (aURL.isSchemeEqualTo(INetProtocol::NotValid))
throw ucb::IllegalIdentifierException();
- if ( aURL.copy( aScheme.getLength(), 3 ) != "://" )
+ if (!aURL.isAnyKnownWebDAVScheme())
throw ucb::IllegalIdentifierException();
uno::Reference< ucb::XContentIdentifier > xCanonicId;
- bool bNewId = false;
- if ( aScheme == WEBDAV_URL_SCHEME )
- {
- aURL = aURL.replaceAt( 0,
- WEBDAV_URL_SCHEME_LENGTH,
- OUString( HTTP_URL_SCHEME ) );
- bNewId = true;
- }
- else if ( aScheme == WEBDAVS_URL_SCHEME )
- {
- aURL = aURL.replaceAt( 0,
- WEBDAVS_URL_SCHEME_LENGTH,
- OUString( HTTPS_URL_SCHEME ) );
- bNewId = true;
- }
- else if ( aScheme == DAV_URL_SCHEME )
- {
- aURL = aURL.replaceAt( 0,
- DAV_URL_SCHEME_LENGTH,
- OUString( HTTP_URL_SCHEME ) );
- bNewId = true;
- }
- else if ( aScheme == DAVS_URL_SCHEME )
+ if (aURL.isSchemeEqualTo(INetProtocol::VndSunStarWebdav) ||
+ aURL.isSchemeEqualTo(DAV_URL_SCHEME) ||
+ aURL.isSchemeEqualTo(INetProtocol::Webdav))
{
- aURL = aURL.replaceAt( 0,
- DAVS_URL_SCHEME_LENGTH,
- OUString( HTTPS_URL_SCHEME ) );
- bNewId = true;
+ aURL.changeScheme(INetProtocol::Http);
+ xCanonicId = new ::ucbhelper::ContentIdentifier( aURL.getExternalURL() );
}
-
- sal_Int32 nPos = aURL.lastIndexOf( '/' );
- if ( nPos != aURL.getLength() - 1 )
+ else if (aURL.isSchemeEqualTo(INetProtocol::VndSunStarWebdavs) ||
+ aURL.isSchemeEqualTo(DAVS_URL_SCHEME) ||
+ aURL.isSchemeEqualTo(INetProtocol::Webdavs))
{
- // Find second slash in URL.
- nPos = aURL.indexOf( '/', aURL.indexOf( '/' ) + 1 );
- if ( nPos == -1 )
- throw ucb::IllegalIdentifierException();
-
- nPos = aURL.indexOf( '/', nPos + 1 );
- if ( nPos == -1 )
- {
- aURL += "/";
- bNewId = true;
- }
+ aURL.changeScheme(INetProtocol::Https);
+ xCanonicId = new ::ucbhelper::ContentIdentifier( aURL.getExternalURL() );
}
-
- if ( bNewId )
- xCanonicId = new ::ucbhelper::ContentIdentifier( aURL );
else
+ {
xCanonicId = Identifier;
+ }
osl::MutexGuard aGuard( m_aMutex );
diff --git a/ucb/source/ucp/webdav/webdavprovider.hxx b/ucb/source/ucp/webdav/webdavprovider.hxx
index bfe65511fa62..1f4640db0478 100644
--- a/ucb/source/ucp/webdav/webdavprovider.hxx
+++ b/ucb/source/ucp/webdav/webdavprovider.hxx
@@ -37,26 +37,19 @@ namespace http_dav_ucp {
// URL scheme. This is the scheme the provider will be able to create
// contents for. The UCB will select the provider ( i.e. in order to create
// contents ) according to this scheme.
-#define WEBDAV_URL_SCHEME "vnd.sun.star.webdav"
-#define WEBDAV_URL_SCHEME_LENGTH 19
-
-#define WEBDAVS_URL_SCHEME "vnd.sun.star.webdavs"
-#define WEBDAVS_URL_SCHEME_LENGTH 20
-
-#define HTTP_URL_SCHEME "http"
-
-#define HTTPS_URL_SCHEME "https"
-
-#define DAV_URL_SCHEME "dav"
-#define DAV_URL_SCHEME_LENGTH 3
-
-#define DAVS_URL_SCHEME "davs"
-#define DAVS_URL_SCHEME_LENGTH 4
+#define VNDSUNSTARWEBDAV_URL_SCHEME "vnd.sun.star.webdav"
+#define VNDSUNSTARWEBDAVS_URL_SCHEME "vnd.sun.star.webdavs"
+#define HTTP_URL_SCHEME "http"
+#define HTTPS_URL_SCHEME "https"
+#define DAV_URL_SCHEME "dav"
+#define DAVS_URL_SCHEME "davs"
+#define WEBDAV_URL_SCHEME "webdav"
+#define WEBDAVS_URL_SCHEME "webdavs"
#define HTTP_CONTENT_TYPE "application/" HTTP_URL_SCHEME "-content"
#define WEBDAV_CONTENT_TYPE HTTP_CONTENT_TYPE
-#define WEBDAV_COLLECTION_TYPE "application/" WEBDAV_URL_SCHEME "-collection"
+#define WEBDAV_COLLECTION_TYPE "application/" VNDSUNSTARWEBDAV_URL_SCHEME "-collection"
class ContentProvider : public ::ucbhelper::ContentProviderImplHelper
More information about the Libreoffice-commits
mailing list