summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2019-08-20 09:38:10 +0200
committerStephan Bergmann <sbergman@redhat.com>2019-08-23 14:47:01 +0200
commit5bbf9ca7ccb60c9d90f2cabbe4be4962329fda61 (patch)
tree58eab725c95f9e5c79391342f0dcf0a30fd25cdd
parent9a251699d728fa6207b71406cd91aafb7803f453 (diff)
[API CHANGE] Adapt css.uri UNOIDL entities to RFC 3986
...which obsoleted RFC 2396. Notable changes are that the distinction between hierarchical and opaque URIs has been dropped, and that the relative URI resolution specification has been made more rigid. As a consequence, various features of css.uri entities have changed: * XUriReference.isHierarchical is obsolete and deprecated. * The behavior of XUriReference.hasAuthority, XUriReference.getAuthority, XUriReference.getPath, XUriReference.hasRelativePath, XUriReference.getPathSegmentCount, XUriReference.getPathSegment, XUriReference.hasQuery, and XUriReference.getQuery has been made consistent for all URIs, no matter whether they were considered hierarchical or opaque in the past. * The behavior of XUriReferenceFactory.makeAbsolute and XUriReferenceFactory.makeRelative has been changed to match the RFC 3986 reference resolution specification. The XUriReferenceFactory.makeAbsolulte parameter processSpecialBaseSegments has been renamed to processAdditionalSpecialSegments, as per the updated specification it now controls treatment of special segments in the given uriReference, in addition to special segments in the given baseUriReference. (Renaming UNOIDL interface method parameters is technically an incompatible change, but the benefits of improved clarity presumably outweigh any potential drawbacks in this case.) The implementation in stoc has been adapted, and various call sites have been adapted to the deprecated XUriReference.isHierarchical semantics. Change-Id: Ic6e00fdbce5abef70d75ec2f753d22fefe361457 Reviewed-on: https://gerrit.libreoffice.org/77861 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
-rw-r--r--dbaccess/source/core/dataaccess/databasecontext.cxx2
-rw-r--r--dbaccess/source/filter/xml/xmlfilter.cxx2
-rw-r--r--stoc/source/uriproc/UriReference.cxx14
-rw-r--r--stoc/source/uriproc/UriReference.hxx3
-rw-r--r--stoc/source/uriproc/UriReferenceFactory.cxx375
-rw-r--r--stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTexpand.cxx2
-rw-r--r--stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx2
-rw-r--r--stoc/test/uriproc/test_uriproc.cxx478
-rw-r--r--svl/source/misc/urihelper.cxx2
-rw-r--r--udkapi/com/sun/star/uri/UriReferenceFactory.idl2
-rw-r--r--udkapi/com/sun/star/uri/XUriReference.idl44
-rw-r--r--udkapi/com/sun/star/uri/XUriReferenceFactory.idl31
-rw-r--r--udkapi/com/sun/star/uri/XUriSchemeParser.idl2
-rw-r--r--udkapi/com/sun/star/uri/XVndSunStarExpandUrl.idl3
-rw-r--r--udkapi/com/sun/star/uri/XVndSunStarScriptUrl.idl3
-rw-r--r--udkapi/type_reference/udkapi.idl2
16 files changed, 735 insertions, 232 deletions
diff --git a/dbaccess/source/core/dataaccess/databasecontext.cxx b/dbaccess/source/core/dataaccess/databasecontext.cxx
index 1c6cb283fe29..6e9a38da6552 100644
--- a/dbaccess/source/core/dataaccess/databasecontext.cxx
+++ b/dbaccess/source/core/dataaccess/databasecontext.cxx
@@ -366,7 +366,7 @@ Reference< XInterface > ODatabaseContext::loadObjectFromURL(const OUString& _rNa
{
// In this case the host contains the real path, and the path is the embedded stream name.
auto const uri = css::uri::UriReferenceFactory::create(m_aContext)->parse(_sURL);
- if (uri.is() && uri->isAbsolute() && uri->isHierarchical()
+ if (uri.is() && uri->isAbsolute()
&& uri->hasAuthority() && !uri->hasQuery() && !uri->hasFragment())
{
auto const auth = uri->getAuthority();
diff --git a/dbaccess/source/filter/xml/xmlfilter.cxx b/dbaccess/source/filter/xml/xmlfilter.cxx
index 93175e1d9f1a..80faab524164 100644
--- a/dbaccess/source/filter/xml/xmlfilter.cxx
+++ b/dbaccess/source/filter/xml/xmlfilter.cxx
@@ -310,7 +310,7 @@ bool ODBFilter::implImport( const Sequence< PropertyValue >& rDescriptor )
// In this case the authority contains the real path, and the path is the embedded stream name.
auto const uri = css::uri::UriReferenceFactory::create(GetComponentContext())
->parse(sFileName);
- if (uri.is() && uri->isAbsolute() && uri->isHierarchical()
+ if (uri.is() && uri->isAbsolute()
&& uri->hasAuthority() && !uri->hasQuery() && !uri->hasFragment())
{
auto const auth = uri->getAuthority();
diff --git a/stoc/source/uriproc/UriReference.cxx b/stoc/source/uriproc/UriReference.cxx
index 28202b7aeac3..468d6653d2c5 100644
--- a/stoc/source/uriproc/UriReference.cxx
+++ b/stoc/source/uriproc/UriReference.cxx
@@ -29,22 +29,18 @@
using stoc::uriproc::UriReference;
UriReference::UriReference(
- OUString const & scheme, bool bIsHierarchical, bool bHasAuthority,
+ OUString const & scheme, bool bHasAuthority,
OUString const & authority, OUString const & path,
bool bHasQuery, OUString const & query):
m_scheme(scheme),
m_authority(authority),
m_path(path),
m_query(query),
- m_isHierarchical(bIsHierarchical),
m_hasAuthority(bHasAuthority),
m_hasQuery(bHasQuery),
m_hasFragment(false)
{
- OSL_ASSERT(!scheme.isEmpty() || bIsHierarchical);
- OSL_ASSERT(!bHasAuthority || bIsHierarchical);
OSL_ASSERT(authority.isEmpty() || bHasAuthority);
- OSL_ASSERT(!bHasQuery || bIsHierarchical);
OSL_ASSERT(query.isEmpty() || bHasQuery);
}
@@ -81,7 +77,7 @@ OUString UriReference::getSchemeSpecificPart()
bool UriReference::isHierarchical() {
osl::MutexGuard g(m_mutex);
- return m_isHierarchical;
+ return m_scheme.isEmpty() || m_hasAuthority || m_path.startsWith("/");
}
bool UriReference::hasAuthority() {
@@ -101,14 +97,14 @@ OUString UriReference::getPath() {
bool UriReference::hasRelativePath() {
osl::MutexGuard g(m_mutex);
- return m_isHierarchical && !m_hasAuthority
+ return !m_hasAuthority
&& (m_path.isEmpty() || m_path[0] != '/');
}
sal_Int32 UriReference::getPathSegmentCount()
{
osl::MutexGuard g(m_mutex);
- if (!m_isHierarchical || m_path.isEmpty()) {
+ if (m_path.isEmpty()) {
return 0;
} else {
sal_Int32 n = m_path[0] == '/' ? 0 : 1;
@@ -126,7 +122,7 @@ sal_Int32 UriReference::getPathSegmentCount()
OUString UriReference::getPathSegment(sal_Int32 index)
{
osl::MutexGuard g(m_mutex);
- if (m_isHierarchical && !m_path.isEmpty() && index >= 0) {
+ if (!m_path.isEmpty() && index >= 0) {
for (sal_Int32 i = m_path[0] == '/' ? 1 : 0;; ++i) {
if (index-- == 0) {
sal_Int32 j = m_path.indexOf('/', i);
diff --git a/stoc/source/uriproc/UriReference.hxx b/stoc/source/uriproc/UriReference.hxx
index fe2f9bb38d19..2f56bfc6f7ca 100644
--- a/stoc/source/uriproc/UriReference.hxx
+++ b/stoc/source/uriproc/UriReference.hxx
@@ -30,7 +30,7 @@ namespace stoc { namespace uriproc {
class UriReference {
public:
UriReference(
- OUString const & scheme, bool isHierarchical, bool hasAuthority,
+ OUString const & scheme, bool hasAuthority,
OUString const & authority, OUString const & path,
bool hasQuery, OUString const & query);
@@ -93,7 +93,6 @@ public:
OUString m_path;
OUString const m_query;
OUString m_fragment;
- bool const m_isHierarchical;
bool const m_hasAuthority;
bool const m_hasQuery;
bool m_hasFragment;
diff --git a/stoc/source/uriproc/UriReferenceFactory.cxx b/stoc/source/uriproc/UriReferenceFactory.cxx
index 779bb36b627b..3a5f30b850de 100644
--- a/stoc/source/uriproc/UriReferenceFactory.cxx
+++ b/stoc/source/uriproc/UriReferenceFactory.cxx
@@ -21,7 +21,9 @@
#include <algorithm>
#include <cassert>
-#include <cstdlib>
+#include <cstddef>
+#include <string_view>
+#include <utility>
#include <vector>
#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
@@ -96,11 +98,11 @@ class UriReference:
{
public:
UriReference(
- OUString const & scheme, bool bIsHierarchical, bool bHasAuthority,
+ OUString const & scheme, bool bHasAuthority,
OUString const & authority, OUString const & path,
bool bHasQuery, OUString const & query):
m_base(
- scheme, bIsHierarchical, bHasAuthority, authority, path, bHasQuery,
+ scheme, bHasAuthority, authority, path, bHasQuery,
query)
{}
@@ -167,75 +169,113 @@ private:
css::uno::Reference< css::uri::XUriReference > parseGeneric(
OUString const & scheme, OUString const & schemeSpecificPart)
{
- bool isAbsolute = !scheme.isEmpty();
- bool isHierarchical = !isAbsolute || schemeSpecificPart.startsWith("/");
+ sal_Int32 len = schemeSpecificPart.getLength();
+ sal_Int32 i = 0;
bool hasAuthority = false;
OUString authority;
- OUString path;
- bool hasQuery = false;
- OUString query;
- if (isHierarchical) {
- sal_Int32 len = schemeSpecificPart.getLength();
- sal_Int32 i = 0;
- if (len - i >= 2 && schemeSpecificPart[i] == '/'
- && schemeSpecificPart[i + 1] == '/')
- {
- i += 2;
- sal_Int32 n = i;
- while (i < len && schemeSpecificPart[i] != '/'
- && schemeSpecificPart[i] != '?') {
- ++i;
- }
- hasAuthority = true;
- authority = schemeSpecificPart.copy(n, i - n);
- }
+ if (len - i >= 2 && schemeSpecificPart[i] == '/'
+ && schemeSpecificPart[i + 1] == '/')
+ {
+ i += 2;
sal_Int32 n = i;
- i = schemeSpecificPart.indexOf('?', i);
- if (i == -1) {
- i = len;
+ while (i < len && schemeSpecificPart[i] != '/'
+ && schemeSpecificPart[i] != '?') {
+ ++i;
}
- path = schemeSpecificPart.copy(n, i - n);
- if (i != len) {
- hasQuery = true;
- query = schemeSpecificPart.copy(i + 1);
- }
- } else {
- if (schemeSpecificPart.isEmpty()) {
- // The scheme-specific part of an opaque URI must not be empty:
- return nullptr;
- }
- path = schemeSpecificPart;
+ hasAuthority = true;
+ authority = schemeSpecificPart.copy(n, i - n);
+ }
+ sal_Int32 n = i;
+ i = schemeSpecificPart.indexOf('?', i);
+ if (i == -1) {
+ i = len;
+ }
+ OUString path = schemeSpecificPart.copy(n, i - n);
+ bool hasQuery = false;
+ OUString query;
+ if (i != len) {
+ hasQuery = true;
+ query = schemeSpecificPart.copy(i + 1);
}
return new UriReference(
- scheme, isHierarchical, hasAuthority, authority, path, hasQuery, query);
+ scheme, hasAuthority, authority, path, hasQuery, query);
}
-void processSegments(
- std::vector<sal_Int32> & segments,
- css::uno::Reference< css::uri::XUriReference > const & uriReference,
- bool base, bool processSpecialSegments)
+struct Segment {
+ bool leadingSlash;
+ bool excessParent;
+ std::u16string_view segment;
+
+ Segment(bool theLeadingSlash, bool theExcessParent, std::u16string_view theSegment):
+ leadingSlash(theLeadingSlash), excessParent(theExcessParent), segment(theSegment) {}
+};
+
+std::pair<std::vector<Segment>, bool> processSegments(
+ std::u16string_view first, std::u16string_view second, bool processSpecialSegments)
{
- sal_Int32 count = uriReference->getPathSegmentCount() - (base ? 1 : 0);
- assert(count <= SAL_MAX_INT32 - 1 && -count >= SAL_MIN_INT32 + 1);
- for (sal_Int32 i = 0; i < count; ++i) {
- if (processSpecialSegments) {
- OUString segment(uriReference->getPathSegment(i));
- if ( segment == "." ) {
- if (!base && i == count - 1) {
- segments.push_back(0);
+ std::vector<Segment> segments;
+ bool processed = false;
+ std::u16string_view const * half = &first;
+ // later checks for `half == &first` and `half == &second` rely on the fact that `first` and
+ // `second` are passed by value, in case a caller passes the same object for both arguments
+ std::size_t index = 0;
+ bool slash = false;
+ if (index == half->length()) {
+ half = &second;
+ index = 0;
+ }
+ if (index != half->length()) {
+ if ((*half)[index] == u'/') {
+ slash = true;
+ ++index;
+ }
+ for (;;) {
+ if (index == half->length() && half == &first) {
+ half = &second;
+ index = 0;
+ }
+ if (index == half->length()) {
+ if (slash) {
+ segments.emplace_back(true, false, std::u16string_view());
}
- continue;
- } else if ( segment == ".." ) {
- if (segments.empty() || std::abs(segments.back()) == 1) {
- segments.push_back(base ? -1 : 1);
- } else {
- segments.pop_back();
+ break;
+ }
+ auto const n = std::min(half->find(u'/', index), half->length());
+ auto const leadingSlash = slash;
+ auto const segment = half->substr(index, n - index);
+ auto const process = processSpecialSegments || half == &second;
+ index = n;
+ slash = false;
+ if (index == half->length() && half == &first) {
+ half = &second;
+ index = 0;
+ }
+ if (index != half->length() && (*half)[index] == u'/') {
+ slash = true;
+ ++index;
+ }
+ if (process) {
+ if (segment == u".") {
+ slash = leadingSlash;
+ processed = true;
+ continue;
+ } else if (segment == u"..") {
+ if (segments.empty() || segments.back().excessParent) {
+ segments.emplace_back(leadingSlash, true, segment);
+ } else {
+ if (leadingSlash) {
+ segments.pop_back();
+ }
+ slash = leadingSlash;
+ }
+ processed = true;
+ continue;
}
- continue;
}
+ segments.emplace_back(leadingSlash, false, segment);
}
- segments.push_back(base ? -(i + 2) : i + 2);
}
+ return {segments, processed};
}
class Factory:
@@ -264,7 +304,7 @@ public:
makeAbsolute(
css::uno::Reference< css::uri::XUriReference > const & baseUriReference,
css::uno::Reference< css::uri::XUriReference > const & uriReference,
- sal_Bool processSpecialBaseSegments,
+ sal_Bool processAdditionalSpecialSegments,
css::uri::RelativeUriExcessParentSegments excessParentSegments) override;
virtual css::uno::Reference< css::uri::XUriReference > SAL_CALL
@@ -373,25 +413,80 @@ css::uno::Reference< css::uri::XUriReference > Factory::parse(
css::uno::Reference< css::uri::XUriReference > Factory::makeAbsolute(
css::uno::Reference< css::uri::XUriReference > const & baseUriReference,
css::uno::Reference< css::uri::XUriReference > const & uriReference,
- sal_Bool processSpecialBaseSegments,
+ sal_Bool processAdditionalSpecialSegments,
css::uri::RelativeUriExcessParentSegments excessParentSegments)
{
if (!baseUriReference.is() || !baseUriReference->isAbsolute()
- || !baseUriReference->isHierarchical() || !uriReference.is()) {
+ || !uriReference.is()) {
return nullptr;
} else if (uriReference->isAbsolute()) {
+ if (processAdditionalSpecialSegments) {
+ auto const path = uriReference->getPath();
+ auto [segments, proc] = processSegments(path, {}, true);
+ if (proc) {
+ OUStringBuffer abs(uriReference->getScheme());
+ abs.append(':');
+ if (uriReference->hasAuthority()) {
+ abs.append("//");
+ abs.append(uriReference->getAuthority());
+ }
+ for (auto const & i : segments)
+ {
+ if (i.excessParent) {
+ switch (excessParentSegments) {
+ case css::uri::RelativeUriExcessParentSegments_ERROR:
+ return nullptr;
+
+ case css::uri::RelativeUriExcessParentSegments_RETAIN:
+ assert(i.segment == u"..");
+ break;
+
+ case css::uri::RelativeUriExcessParentSegments_REMOVE:
+ continue;
+
+ default:
+ assert(false);
+ break;
+ }
+ }
+ if (i.leadingSlash) {
+ abs.append('/');
+ }
+ abs.append(i.segment);
+ }
+ if (uriReference->hasQuery()) {
+ abs.append('?');
+ abs.append(uriReference->getQuery());
+ }
+ if (uriReference->hasFragment()) {
+ abs.append('#');
+ abs.append(uriReference->getFragment());
+ }
+ return parse(abs.makeStringAndClear());
+ }
+ }
return clone(uriReference);
} else if (!uriReference->hasAuthority()
- && uriReference->getPath().isEmpty()
- && !uriReference->hasQuery()) {
- css::uno::Reference< css::uri::XUriReference > abs(
- clone(baseUriReference));
+ && uriReference->getPath().isEmpty()) {
+ OUStringBuffer abs(baseUriReference->getScheme());
+ abs.append(':');
+ if (baseUriReference->hasAuthority()) {
+ abs.append("//");
+ abs.append(baseUriReference->getAuthority());
+ }
+ abs.append(baseUriReference->getPath());
+ if (uriReference->hasQuery()) {
+ abs.append('?');
+ abs.append(uriReference->getQuery());
+ } else if (baseUriReference->hasQuery()) {
+ abs.append('?');
+ abs.append(baseUriReference->getQuery());
+ }
if (uriReference->hasFragment()) {
- abs->setFragment(uriReference->getFragment());
- } else {
- abs->clearFragment();
+ abs.append('#');
+ abs.append(uriReference->getFragment());
}
- return abs;
+ return parse(abs.makeStringAndClear());
} else {
OUStringBuffer abs(baseUriReference->getScheme());
abs.append(':');
@@ -403,73 +498,77 @@ css::uno::Reference< css::uri::XUriReference > Factory::makeAbsolute(
abs.append(baseUriReference->getAuthority());
}
if (uriReference->hasRelativePath()) {
- std::vector<sal_Int32> segments;
- processSegments(
- segments, baseUriReference, true, processSpecialBaseSegments);
- processSegments(segments, uriReference, false, true);
- // If the path component of the base URI reference is empty (which
- // implies that the base URI reference denotes a "root entity"), and
- // the resulting URI reference denotes the same root entity, make
- // sure the path component of the resulting URI reference is also
- // empty (and not "/"). RFC 2396 is unclear about this, and I chose
- // these rules for consistent results.
- bool slash = !baseUriReference->getPath().isEmpty();
- if (slash) {
- abs.append('/');
+ auto path1 = baseUriReference->getPath();
+ if (path1.isEmpty()) {
+ if (baseUriReference->hasAuthority()) {
+ path1 = "/";
+ }
+ } else {
+ path1 = path1.copy(0, path1.lastIndexOf('/') + 1);
}
- for (const auto& i : segments)
+ auto const path2 = uriReference->getPath();
+ auto [segments, _] = processSegments(path1, path2, processAdditionalSpecialSegments);
+ (void)_;
+ for (auto const & i : segments)
{
- if (i < -1) {
- OUString segment(
- baseUriReference->getPathSegment(-(i + 2)));
- if (!segment.isEmpty() || segments.size() > 1) {
- if (!slash) {
- abs.append('/');
- }
- abs.append(segment);
- slash = true;
- abs.append('/');
- }
- } else if (i > 1) {
- OUString segment(uriReference->getPathSegment(i - 2));
- if (!segment.isEmpty() || segments.size() > 1) {
- if (!slash) {
- abs.append('/');
- }
- abs.append(segment);
- slash = false;
- }
- } else if (i == 0) {
- if (segments.size() > 1 && !slash) {
- abs.append('/');
- }
- } else {
+ if (i.excessParent) {
switch (excessParentSegments) {
case css::uri::RelativeUriExcessParentSegments_ERROR:
return nullptr;
case css::uri::RelativeUriExcessParentSegments_RETAIN:
- if (!slash) {
- abs.append('/');
- }
- abs.append("..");
- slash = i < 0;
- if (slash) {
- abs.append('/');
- }
+ assert(i.segment == u"..");
break;
case css::uri::RelativeUriExcessParentSegments_REMOVE:
- break;
+ continue;
default:
assert(false);
break;
}
}
+ if (i.leadingSlash) {
+ abs.append('/');
+ }
+ abs.append(i.segment);
}
} else {
- abs.append(uriReference->getPath());
+ bool processed = false;
+ if (processAdditionalSpecialSegments) {
+ auto const path = uriReference->getPath();
+ auto [segments, proc] = processSegments(path, {}, true);
+ if (proc) {
+ for (auto const & i : segments)
+ {
+ if (i.excessParent) {
+ switch (excessParentSegments) {
+ case css::uri::RelativeUriExcessParentSegments_ERROR:
+ return nullptr;
+
+ case css::uri::RelativeUriExcessParentSegments_RETAIN:
+ assert(i.segment == u"..");
+ break;
+
+ case css::uri::RelativeUriExcessParentSegments_REMOVE:
+ continue;
+
+ default:
+ assert(false);
+ break;
+ }
+ }
+ if (i.leadingSlash) {
+ abs.append('/');
+ }
+ abs.append(i.segment);
+ }
+ processed = true;
+ }
+ }
+ if (!processed) {
+ abs.append(uriReference->getPath());
+ }
}
if (uriReference->hasQuery()) {
abs.append('?');
@@ -491,9 +590,9 @@ css::uno::Reference< css::uri::XUriReference > Factory::makeRelative(
sal_Bool encodeRetainedSpecialSegments)
{
if (!baseUriReference.is() || !baseUriReference->isAbsolute()
- || !baseUriReference->isHierarchical() || !uriReference.is()) {
+ || !uriReference.is()) {
return nullptr;
- } else if (!uriReference->isAbsolute() || !uriReference->isHierarchical()
+ } else if (!uriReference->isAbsolute() || uriReference->hasRelativePath()
|| !baseUriReference->getScheme().equalsIgnoreAsciiCase(
uriReference->getScheme())) {
return clone(uriReference);
@@ -512,8 +611,8 @@ css::uno::Reference< css::uri::XUriReference > Factory::makeRelative(
rel.append(uriReference->getPath());
} else if ((equalIgnoreEscapeCase(
baseUriReference->getPath(), uriReference->getPath())
- || (baseUriReference->getPath().getLength() <= 1
- && uriReference->getPath().getLength() <= 1))
+ || (baseUriReference->getPath() == "/"
+ && uriReference->getPath().isEmpty()))
&& baseUriReference->hasQuery() == uriReference->hasQuery()
&& equalIgnoreEscapeCase(
baseUriReference->getQuery(), uriReference->getQuery()))
@@ -533,24 +632,30 @@ css::uno::Reference< css::uri::XUriReference > Factory::makeRelative(
break;
}
}
- if (i == 0 && preferAbsoluteOverRelativePath
+ if (i == 0
+ && (preferAbsoluteOverRelativePath || uriReference->hasQuery())
&& (preferAuthorityOverRelativePath
|| !uriReference->getPath().startsWith("//")))
{
- if (baseUriReference->getPath().getLength() > 1
- || uriReference->getPath().getLength() > 1)
- {
- if (uriReference->getPath().isEmpty()) {
+ if (uriReference->getPath().isEmpty()) {
+ if (!baseUriReference->getPath().isEmpty()
+ && baseUriReference->getPath() != "/")
+ {
rel.append('/');
- } else {
- assert(uriReference->getPath()[0] == '/');
- if (uriReference->getPath().startsWith("//")) {
- assert(uriReference->hasAuthority());
- rel.append("//");
- rel.append(uriReference->getAuthority());
- }
- rel.append(uriReference->getPath());
}
+ } else if (uriReference->getPath() == "/") {
+ if (baseUriReference->getPath().isEmpty()
+ || baseUriReference->getPath() != "/")
+ {
+ rel.append('/');
+ }
+ } else {
+ if (uriReference->getPath().startsWith("//")) {
+ assert(uriReference->hasAuthority());
+ rel.append("//");
+ rel.append(uriReference->getAuthority());
+ }
+ rel.append(uriReference->getPath());
}
} else {
bool segments = false;
diff --git a/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTexpand.cxx b/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTexpand.cxx
index 105d00bb1e80..cebe754cbaaa 100644
--- a/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTexpand.cxx
+++ b/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTexpand.cxx
@@ -56,7 +56,7 @@ class UrlReference:
public:
UrlReference(OUString const & scheme, OUString const & path):
base_(
- scheme, false, false, OUString(), path, false,
+ scheme, false, OUString(), path, false,
OUString())
{}
diff --git a/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx b/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx
index 2f4cb9e09071..1191a711262f 100644
--- a/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx
+++ b/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx
@@ -191,7 +191,7 @@ class UrlReference:
public:
UrlReference(OUString const & scheme, OUString const & path):
m_base(
- scheme, false, false, OUString(), path, false, OUString())
+ scheme, false, OUString(), path, false, OUString())
{}
UrlReference(const UrlReference&) = delete;
diff --git a/stoc/test/uriproc/test_uriproc.cxx b/stoc/test/uriproc/test_uriproc.cxx
index a3f45a98476d..f30913c2841f 100644
--- a/stoc/test/uriproc/test_uriproc.cxx
+++ b/stoc/test/uriproc/test_uriproc.cxx
@@ -167,8 +167,8 @@ void Test::testParse() {
Data data[] = {
{ "", nullptr, "", true, nullptr,
"", true, 0, "", "", "", "", "", nullptr, nullptr },
- { "scheme:", nullptr, nullptr, false, nullptr,
- nullptr, false, 0, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr },
+ { "scheme:", "scheme", "", false, nullptr,
+ "", true, 0, "", "", "", "", "", nullptr, nullptr },
{ "scheme:/", "scheme", "/", true, nullptr,
"/", false, 1, "", "", "", "", "", nullptr, nullptr },
{ "scheme://", "scheme", "//", true, "",
@@ -179,10 +179,10 @@ void Test::testParse() {
"//", false, 2, "", "", "", "", "", nullptr, nullptr },
{ "scheme:////", "scheme", "////", true, "",
"//", false, 2, "", "", "", "", "", nullptr, nullptr },
- { "scheme:#", nullptr, nullptr, false, nullptr,
- nullptr, false, 0, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr },
+ { "scheme:#", "scheme", "", false, nullptr,
+ "", true, 0, "", "", "", "", "", nullptr, "" },
{ "scheme:?", "scheme", "?", false, nullptr,
- "?", false, 0, "", "", "", "", "", nullptr, nullptr },
+ "", true, 0, "", "", "", "", "", "", nullptr },
{ "/", nullptr, "/", true, nullptr,
"/", false, 1, "", "", "", "", "", nullptr, nullptr },
{ "//", nullptr, "//", true, "",
@@ -293,7 +293,7 @@ void Test::testMakeAbsolute() {
char const * absolute;
};
Data data[] = {
- // The following tests are taken from RFC 2396, Appendix C:
+ // The following tests are taken from RFC 3986, Section 5.4:
{ "http://a/b/c/d;p?q", "g:h", true,
css::uri::RelativeUriExcessParentSegments_ERROR, "g:h" },
{ "http://a/b/c/d;p?q", "g", true,
@@ -307,7 +307,7 @@ void Test::testMakeAbsolute() {
{ "http://a/b/c/d;p?q", "//g", true,
css::uri::RelativeUriExcessParentSegments_ERROR, "http://g" },
{ "http://a/b/c/d;p?q", "?y", true,
- css::uri::RelativeUriExcessParentSegments_ERROR, "http://a/b/c/?y" },
+ css::uri::RelativeUriExcessParentSegments_ERROR, "http://a/b/c/d;p?y" },
{ "http://a/b/c/d;p?q", "g?y", true,
css::uri::RelativeUriExcessParentSegments_ERROR,
"http://a/b/c/g?y" },
@@ -328,6 +328,9 @@ void Test::testMakeAbsolute() {
{ "http://a/b/c/d;p?q", "g;x?y#s", true,
css::uri::RelativeUriExcessParentSegments_ERROR,
"http://a/b/c/g;x?y#s" },
+ { "http://a/b/c/d;p?q", "", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR,
+ "http://a/b/c/d;p?q" },
{ "http://a/b/c/d;p?q", ".", true,
css::uri::RelativeUriExcessParentSegments_ERROR, "http://a/b/c/" },
{ "http://a/b/c/d;p?q", "./", true,
@@ -344,9 +347,6 @@ void Test::testMakeAbsolute() {
css::uri::RelativeUriExcessParentSegments_ERROR, "http://a/" },
{ "http://a/b/c/d;p?q", "../../g", true,
css::uri::RelativeUriExcessParentSegments_ERROR, "http://a/g" },
- { "http://a/b/c/d;p?q", "", true,
- css::uri::RelativeUriExcessParentSegments_ERROR,
- "http://a/b/c/d;p?q" },
{ "http://a/b/c/d;p?q", "../../../g", true,
css::uri::RelativeUriExcessParentSegments_ERROR, nullptr },
{ "http://a/b/c/d;p?q", "../../../g", true,
@@ -361,9 +361,13 @@ void Test::testMakeAbsolute() {
{ "http://a/b/c/d;p?q", "../../../../g", true,
css::uri::RelativeUriExcessParentSegments_REMOVE, "http://a/g" },
{ "http://a/b/c/d;p?q", "/./g", true,
- css::uri::RelativeUriExcessParentSegments_ERROR, "http://a/./g" },
+ css::uri::RelativeUriExcessParentSegments_ERROR, "http://a/g" },
{ "http://a/b/c/d;p?q", "/../g", true,
- css::uri::RelativeUriExcessParentSegments_ERROR, "http://a/../g" },
+ css::uri::RelativeUriExcessParentSegments_ERROR, nullptr },
+ { "http://a/b/c/d;p?q", "/../g", true,
+ css::uri::RelativeUriExcessParentSegments_RETAIN, "http://a/../g" },
+ { "http://a/b/c/d;p?q", "/../g", true,
+ css::uri::RelativeUriExcessParentSegments_REMOVE, "http://a/g" },
{ "http://a/b/c/d;p?q", "g.", true,
css::uri::RelativeUriExcessParentSegments_ERROR, "http://a/b/c/g." },
{ "http://a/b/c/d;p?q", ".g", true,
@@ -403,48 +407,91 @@ void Test::testMakeAbsolute() {
{ "http://a/b/c/d;p?q", "http:g", true,
css::uri::RelativeUriExcessParentSegments_ERROR, "http:g" },
+ { "scheme:", "", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:" },
+ { "scheme:", ".", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:" },
+ { "scheme:", "./", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:" },
+ { "scheme:", "./.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:" },
+ { "scheme:", "././", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:" },
+ { "scheme:", "././.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:" },
+ { "scheme:", "x/..", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/" },
+ { "scheme:", "x/../", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/" },
+ { "scheme:", "x/../.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/" },
+ { "scheme:", "x/.././", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/" },
+ { "scheme:", "x/.././.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/" },
+ { "scheme:", "x/../././", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/" },
+ { "scheme:", "x/../././.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/" },
+ { "scheme:", "./x/..", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/" },
+ { "scheme:", "././x/..", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/" },
+ { "scheme:", "./././x/..", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/" },
+ { "scheme:", "./x/../.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/" },
+ { "scheme:", "./x/.././", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/" },
+ { "scheme:", "././x/.././.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/" },
+ { "scheme:", "././x/../././", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/" },
+ { "scheme:", "./././x/../././.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/" },
+
{ "scheme://a", "", true,
css::uri::RelativeUriExcessParentSegments_ERROR, "scheme://a" },
{ "scheme://a", ".", true,
- css::uri::RelativeUriExcessParentSegments_ERROR, "scheme://a" },
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme://a/" },
{ "scheme://a", "./", true,
- css::uri::RelativeUriExcessParentSegments_ERROR, "scheme://a" },
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme://a/" },
{ "scheme://a", "./.", true,
- css::uri::RelativeUriExcessParentSegments_ERROR, "scheme://a" },
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme://a/" },
{ "scheme://a", "././", true,
- css::uri::RelativeUriExcessParentSegments_ERROR, "scheme://a" },
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme://a/" },
{ "scheme://a", "././.", true,
- css::uri::RelativeUriExcessParentSegments_ERROR, "scheme://a" },
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme://a/" },
{ "scheme://a", "x/..", true,
- css::uri::RelativeUriExcessParentSegments_ERROR, "scheme://a" },
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme://a/" },
{ "scheme://a", "x/../", true,
- css::uri::RelativeUriExcessParentSegments_ERROR, "scheme://a" },
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme://a/" },
{ "scheme://a", "x/../.", true,
- css::uri::RelativeUriExcessParentSegments_ERROR, "scheme://a" },
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme://a/" },
{ "scheme://a", "x/.././", true,
- css::uri::RelativeUriExcessParentSegments_ERROR, "scheme://a" },
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme://a/" },
{ "scheme://a", "x/.././.", true,
- css::uri::RelativeUriExcessParentSegments_ERROR, "scheme://a" },
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme://a/" },
{ "scheme://a", "x/../././", true,
- css::uri::RelativeUriExcessParentSegments_ERROR, "scheme://a" },
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme://a/" },
{ "scheme://a", "x/../././.", true,
- css::uri::RelativeUriExcessParentSegments_ERROR, "scheme://a" },
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme://a/" },
{ "scheme://a", "./x/..", true,
- css::uri::RelativeUriExcessParentSegments_ERROR, "scheme://a" },
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme://a/" },
{ "scheme://a", "././x/..", true,
- css::uri::RelativeUriExcessParentSegments_ERROR, "scheme://a" },
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme://a/" },
{ "scheme://a", "./././x/..", true,
- css::uri::RelativeUriExcessParentSegments_ERROR, "scheme://a" },
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme://a/" },
{ "scheme://a", "./x/../.", true,
- css::uri::RelativeUriExcessParentSegments_ERROR, "scheme://a" },
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme://a/" },
{ "scheme://a", "./x/.././", true,
- css::uri::RelativeUriExcessParentSegments_ERROR, "scheme://a" },
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme://a/" },
{ "scheme://a", "././x/.././.", true,
- css::uri::RelativeUriExcessParentSegments_ERROR, "scheme://a" },
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme://a/" },
{ "scheme://a", "././x/../././", true,
- css::uri::RelativeUriExcessParentSegments_ERROR, "scheme://a" },
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme://a/" },
{ "scheme://a", "./././x/../././.", true,
- css::uri::RelativeUriExcessParentSegments_ERROR, "scheme://a" },
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme://a/" },
{ "scheme://a/", "", true,
css::uri::RelativeUriExcessParentSegments_ERROR, "scheme://a/" },
@@ -575,6 +622,350 @@ void Test::testMakeAbsolute() {
{ "scheme://a/b/", "./././x/../././.", true,
css::uri::RelativeUriExcessParentSegments_ERROR, "scheme://a/b/" },
+ { "scheme:a", "", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a" },
+ { "scheme:a", ".", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:" },
+ { "scheme:a", "./", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:" },
+ { "scheme:a", "./.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:" },
+ { "scheme:a", "././", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:" },
+ { "scheme:a", "././.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:" },
+ { "scheme:a", "x/..", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/" },
+ { "scheme:a", "x/../", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/" },
+ { "scheme:a", "x/../.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/" },
+ { "scheme:a", "x/.././", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/" },
+ { "scheme:a", "x/.././.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/" },
+ { "scheme:a", "x/../././", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/" },
+ { "scheme:a", "x/../././.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/" },
+ { "scheme:a", "./x/..", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/" },
+ { "scheme:a", "././x/..", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/" },
+ { "scheme:a", "./././x/..", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/" },
+ { "scheme:a", "./x/../.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/" },
+ { "scheme:a", "./x/.././", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/" },
+ { "scheme:a", "././x/.././.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/" },
+ { "scheme:a", "././x/../././", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/" },
+ { "scheme:a", "./././x/../././.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/" },
+
+ { "scheme:a/", "", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/" },
+ { "scheme:a/", ".", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/" },
+ { "scheme:a/", "./", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/" },
+ { "scheme:a/", "./.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/" },
+ { "scheme:a/", "././", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/" },
+ { "scheme:a/", "././.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/" },
+ { "scheme:a/", "x/..", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/" },
+ { "scheme:a/", "x/../", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/" },
+ { "scheme:a/", "x/../.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/" },
+ { "scheme:a/", "x/.././", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/" },
+ { "scheme:a/", "x/.././.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/" },
+ { "scheme:a/", "x/../././", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/" },
+ { "scheme:a/", "x/../././.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/" },
+ { "scheme:a/", "./x/..", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/" },
+ { "scheme:a/", "././x/..", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/" },
+ { "scheme:a/", "./././x/..", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/" },
+ { "scheme:a/", "./x/../.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/" },
+ { "scheme:a/", "./x/.././", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/" },
+ { "scheme:a/", "././x/.././.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/" },
+ { "scheme:a/", "././x/../././", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/" },
+ { "scheme:a/", "./././x/../././.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/" },
+
+ { "scheme:a/b", "", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/b" },
+ { "scheme:a/b", ".", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/" },
+ { "scheme:a/b", "./", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/" },
+ { "scheme:a/b", "./.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/" },
+ { "scheme:a/b", "././", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/" },
+ { "scheme:a/b", "././.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/" },
+ { "scheme:a/b", "x/..", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/" },
+ { "scheme:a/b", "x/../", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/" },
+ { "scheme:a/b", "x/../.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/" },
+ { "scheme:a/b", "x/.././", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/" },
+ { "scheme:a/b", "x/.././.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/" },
+ { "scheme:a/b", "x/../././", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/" },
+ { "scheme:a/b", "x/../././.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/" },
+ { "scheme:a/b", "./x/..", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/" },
+ { "scheme:a/b", "././x/..", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/" },
+ { "scheme:a/b", "./././x/..", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/" },
+ { "scheme:a/b", "./x/../.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/" },
+ { "scheme:a/b", "./x/.././", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/" },
+ { "scheme:a/b", "././x/.././.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/" },
+ { "scheme:a/b", "././x/../././", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/" },
+ { "scheme:a/b", "./././x/../././.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/" },
+
+ { "scheme:a/b/", "", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/b/" },
+ { "scheme:a/b/", ".", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/b/" },
+ { "scheme:a/b/", "./", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/b/" },
+ { "scheme:a/b/", "./.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/b/" },
+ { "scheme:a/b/", "././", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/b/" },
+ { "scheme:a/b/", "././.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/b/" },
+ { "scheme:a/b/", "x/..", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/b/" },
+ { "scheme:a/b/", "x/../", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/b/" },
+ { "scheme:a/b/", "x/../.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/b/" },
+ { "scheme:a/b/", "x/.././", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/b/" },
+ { "scheme:a/b/", "x/.././.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/b/" },
+ { "scheme:a/b/", "x/../././", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/b/" },
+ { "scheme:a/b/", "x/../././.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/b/" },
+ { "scheme:a/b/", "./x/..", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/b/" },
+ { "scheme:a/b/", "././x/..", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/b/" },
+ { "scheme:a/b/", "./././x/..", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/b/" },
+ { "scheme:a/b/", "./x/../.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/b/" },
+ { "scheme:a/b/", "./x/.././", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/b/" },
+ { "scheme:a/b/", "././x/.././.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/b/" },
+ { "scheme:a/b/", "././x/../././", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/b/" },
+ { "scheme:a/b/", "./././x/../././.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:a/b/" },
+
+ { "scheme:/a", "", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a" },
+ { "scheme:/a", ".", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/" },
+ { "scheme:/a", "./", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/" },
+ { "scheme:/a", "./.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/" },
+ { "scheme:/a", "././", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/" },
+ { "scheme:/a", "././.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/" },
+ { "scheme:/a", "x/..", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/" },
+ { "scheme:/a", "x/../", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/" },
+ { "scheme:/a", "x/../.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/" },
+ { "scheme:/a", "x/.././", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/" },
+ { "scheme:/a", "x/.././.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/" },
+ { "scheme:/a", "x/../././", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/" },
+ { "scheme:/a", "x/../././.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/" },
+ { "scheme:/a", "./x/..", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/" },
+ { "scheme:/a", "././x/..", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/" },
+ { "scheme:/a", "./././x/..", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/" },
+ { "scheme:/a", "./x/../.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/" },
+ { "scheme:/a", "./x/.././", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/" },
+ { "scheme:/a", "././x/.././.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/" },
+ { "scheme:/a", "././x/../././", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/" },
+ { "scheme:/a", "./././x/../././.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/" },
+
+ { "scheme:/a/", "", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/" },
+ { "scheme:/a/", ".", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/" },
+ { "scheme:/a/", "./", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/" },
+ { "scheme:/a/", "./.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/" },
+ { "scheme:/a/", "././", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/" },
+ { "scheme:/a/", "././.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/" },
+ { "scheme:/a/", "x/..", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/" },
+ { "scheme:/a/", "x/../", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/" },
+ { "scheme:/a/", "x/../.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/" },
+ { "scheme:/a/", "x/.././", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/" },
+ { "scheme:/a/", "x/.././.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/" },
+ { "scheme:/a/", "x/../././", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/" },
+ { "scheme:/a/", "x/../././.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/" },
+ { "scheme:/a/", "./x/..", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/" },
+ { "scheme:/a/", "././x/..", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/" },
+ { "scheme:/a/", "./././x/..", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/" },
+ { "scheme:/a/", "./x/../.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/" },
+ { "scheme:/a/", "./x/.././", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/" },
+ { "scheme:/a/", "././x/.././.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/" },
+ { "scheme:/a/", "././x/../././", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/" },
+ { "scheme:/a/", "./././x/../././.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/" },
+
+ { "scheme:/a/b", "", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/b" },
+ { "scheme:/a/b", ".", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/" },
+ { "scheme:/a/b", "./", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/" },
+ { "scheme:/a/b", "./.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/" },
+ { "scheme:/a/b", "././", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/" },
+ { "scheme:/a/b", "././.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/" },
+ { "scheme:/a/b", "x/..", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/" },
+ { "scheme:/a/b", "x/../", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/" },
+ { "scheme:/a/b", "x/../.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/" },
+ { "scheme:/a/b", "x/.././", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/" },
+ { "scheme:/a/b", "x/.././.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/" },
+ { "scheme:/a/b", "x/../././", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/" },
+ { "scheme:/a/b", "x/../././.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/" },
+ { "scheme:/a/b", "./x/..", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/" },
+ { "scheme:/a/b", "././x/..", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/" },
+ { "scheme:/a/b", "./././x/..", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/" },
+ { "scheme:/a/b", "./x/../.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/" },
+ { "scheme:/a/b", "./x/.././", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/" },
+ { "scheme:/a/b", "././x/.././.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/" },
+ { "scheme:/a/b", "././x/../././", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/" },
+ { "scheme:/a/b", "./././x/../././.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/" },
+
+ { "scheme:/a/b/", "", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/b/" },
+ { "scheme:/a/b/", ".", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/b/" },
+ { "scheme:/a/b/", "./", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/b/" },
+ { "scheme:/a/b/", "./.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/b/" },
+ { "scheme:/a/b/", "././", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/b/" },
+ { "scheme:/a/b/", "././.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/b/" },
+ { "scheme:/a/b/", "x/..", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/b/" },
+ { "scheme:/a/b/", "x/../", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/b/" },
+ { "scheme:/a/b/", "x/../.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/b/" },
+ { "scheme:/a/b/", "x/.././", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/b/" },
+ { "scheme:/a/b/", "x/.././.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/b/" },
+ { "scheme:/a/b/", "x/../././", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/b/" },
+ { "scheme:/a/b/", "x/../././.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/b/" },
+ { "scheme:/a/b/", "./x/..", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/b/" },
+ { "scheme:/a/b/", "././x/..", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/b/" },
+ { "scheme:/a/b/", "./././x/..", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/b/" },
+ { "scheme:/a/b/", "./x/../.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/b/" },
+ { "scheme:/a/b/", "./x/.././", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/b/" },
+ { "scheme:/a/b/", "././x/.././.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/b/" },
+ { "scheme:/a/b/", "././x/../././", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/b/" },
+ { "scheme:/a/b/", "./././x/../././.", true,
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme:/a/b/" },
+
{ "scheme://a#s", "", true,
css::uri::RelativeUriExcessParentSegments_ERROR, "scheme://a" },
{ "scheme://a", "?q", true,
@@ -584,7 +975,10 @@ void Test::testMakeAbsolute() {
{ "scheme://a", "#s", true,
css::uri::RelativeUriExcessParentSegments_ERROR, "scheme://a#s" },
{ "scheme://a#s1", "#s2", true,
- css::uri::RelativeUriExcessParentSegments_ERROR, "scheme://a#s2" } };
+ css::uri::RelativeUriExcessParentSegments_ERROR, "scheme://a#s2" },
+
+ { "schema://a", "schema://b/c/../d", true, css::uri::RelativeUriExcessParentSegments_ERROR,
+ "schema://b/d" } };
for (std::size_t i = 0; i < SAL_N_ELEMENTS(data); ++i) {
css::uno::Reference< css::uri::XUriReference > baseUriRef(
m_uriFactory->parse(
@@ -632,20 +1026,20 @@ void Test::testMakeRelative() {
"scheme://a/b/e?q#s" },
{ "scheme://a/b", "scheme://a?q", true, true, false, "/?q",
"scheme://a/?q" },
- { "scheme://a/b", "scheme://a?q", true, false, false, "?q",
+ { "scheme://a/b", "scheme://a?q", true, false, false, "/?q",
"scheme://a/?q" },
{ "scheme://a", "scheme://a?q", true, true, false, "?q", nullptr },
{ "scheme://a/", "scheme://a?q", true, true, false, "?q",
"scheme://a/?q" },
- { "scheme://a", "scheme://a/?q", true, true, false, "?q",
- "scheme://a?q" },
+ { "scheme://a", "scheme://a/?q", true, true, false, "/?q",
+ nullptr },
{ "scheme://a/", "scheme://a/?q", true, true, false, "?q",
nullptr },
{ "scheme://a?q", "scheme://a?q", true, true, false, "", nullptr },
{ "scheme://a/?q", "scheme://a?q", true, true, false, "",
"scheme://a/?q" },
- { "scheme://a?q", "scheme://a/?q", true, true, false, "",
- "scheme://a?q" },
+ { "scheme://a?q", "scheme://a/?q", true, true, false, "/?q",
+ nullptr },
{ "scheme://a/?q", "scheme://a/?q", true, true, false, "", nullptr },
{ "scheme://a/b/c/d", "scheme://a//", true, true, false, "//a//", nullptr },
{ "scheme://a/b/c/d", "scheme://a//", false, true, false, "../..//",
@@ -689,7 +1083,13 @@ void Test::testMakeRelative() {
{ "scheme://auth/a/b", "scheme://auth/c/d", true, true, false, "/c/d",
nullptr },
{ "scheme://auth/a/b", "scheme://auth/c/d", true, false, false,
- "../c/d", nullptr } };
+ "../c/d", nullptr },
+ { "scheme:a/b/c", "scheme://d/e/f", true, true, false, "//d/e/f", nullptr },
+ { "scheme:/a/b/c", "scheme://d/e/f", true, true, false, "//d/e/f", nullptr },
+ { "scheme:a/b/c", "scheme:/d/e/f", true, true, false, "/d/e/f", nullptr },
+ { "scheme:/a/b/c", "scheme:/d/e/f", true, true, false, "/d/e/f", nullptr },
+ { "scheme:a/b/c", "scheme:d/e/f", true, true, false, "scheme:d/e/f", nullptr },
+ { "scheme:/a/b/c", "scheme:d/e/f", true, true, false, "scheme:d/e/f", nullptr } };
for (std::size_t i = 0; i < SAL_N_ELEMENTS(data); ++i) {
css::uno::Reference< css::uri::XUriReference > baseUriRef(
m_uriFactory->parse(
diff --git a/svl/source/misc/urihelper.cxx b/svl/source/misc/urihelper.cxx
index 7f137fb5a908..62177ac79e25 100644
--- a/svl/source/misc/urihelper.cxx
+++ b/svl/source/misc/urihelper.cxx
@@ -125,7 +125,7 @@ bool isAbsoluteHierarchicalUriReference(
css::uno::Reference< css::uri::XUriReference > const & uriReference)
{
return uriReference.is() && uriReference->isAbsolute()
- && uriReference->isHierarchical() && !uriReference->hasRelativePath();
+ && !uriReference->hasRelativePath();
}
// To improve performance, assume that if for any prefix URL of a given
diff --git a/udkapi/com/sun/star/uri/UriReferenceFactory.idl b/udkapi/com/sun/star/uri/UriReferenceFactory.idl
index cddc9cf383a2..c19e8167d1d1 100644
--- a/udkapi/com/sun/star/uri/UriReferenceFactory.idl
+++ b/udkapi/com/sun/star/uri/UriReferenceFactory.idl
@@ -27,7 +27,7 @@ published interface XUriReferenceFactory;
/**
creates URI references.
- <p>See <a href="http://www.ietf.org/rfc/rfc2396.txt">RFC&nbsp;2396</a> for a
+ <p>See <a href="http://www.ietf.org/rfc/rfc3986.txt">RFC&nbsp;3986</a> for a
description of URI references and related terms.</p>
<p>For parsing absolute URI references, this service tries to use a
diff --git a/udkapi/com/sun/star/uri/XUriReference.idl b/udkapi/com/sun/star/uri/XUriReference.idl
index 147eaba79f2e..ba42f283f8c6 100644
--- a/udkapi/com/sun/star/uri/XUriReference.idl
+++ b/udkapi/com/sun/star/uri/XUriReference.idl
@@ -27,7 +27,7 @@ module com { module sun { module star { module uri {
/**
represents generic, mutable URI references.
- <p>See <a href="http://www.ietf.org/rfc/rfc2396.txt">RFC&nbsp;2396</a> for a
+ <p>See <a href="http://www.ietf.org/rfc/rfc3986.txt">RFC&nbsp;3986</a> for a
description of URI references and related terms.</p>
<p>This interface only handles generic URI references (both absolute and
@@ -54,6 +54,8 @@ published interface XUriReference: com::sun::star::uno::XInterface {
/**
returns whether this URI reference is absolute or relative.
+ <p>A URI is absolute if it has a scheme.</p>
+
@returns
`TRUE` if this URI reference is absolute, `FALSE` if it is relative.
*/
@@ -86,7 +88,7 @@ published interface XUriReference: com::sun::star::uno::XInterface {
string getSchemeSpecificPart();
/**
- returns whether this URI reference is hierarchical or opaque.
+ returns whether this URI reference is hierarchical or opaque, in the sense of RFC&nbsp2396.
<p>An absolute URI reference is hierarchical if its scheme-specific part
starts with &ldquo;<code>/</code>&rdquo;. A relative URI reference is
@@ -94,23 +96,25 @@ published interface XUriReference: com::sun::star::uno::XInterface {
@returns
`TRUE` if this URI reference is hierarchical, `FALSE` if it is opaque.
+
+ @deprecated RFC&nbsp;3986 no longer differentiates between hierarchical and opaque URIs.
*/
boolean isHierarchical();
/**
- returns whether this (hierarchical) URI reference has an authority part.
+ returns whether this URI reference has an authority part.
@returns
- `TRUE` if this URI reference is hierarchical and has an authority part.
+ `TRUE` if this URI reference has an authority part.
*/
boolean hasAuthority();
/**
- returns the authority part of this (hierarchical) URI reference.
+ returns the authority part of this URI reference.
@returns
the textual representation of the authority part (with the exact spelling
- retained), if this is a hierarchical URI reference that has an authority
+ retained), if this is a URI reference that has an authority
part; otherwise, an empty `string` is returned.
*/
string getAuthority();
@@ -120,28 +124,26 @@ published interface XUriReference: com::sun::star::uno::XInterface {
@returns
the textual representation of the path part (with the exact spelling
- retained), if this is a hierarchical URI reference; for an opaque URI
- reference, the scheme-specific part (with the exact spelling retained) is
- returned.
+ retained).
*/
string getPath();
/**
- returns whether this (relative) URI reference has a relative path.
+ returns whether this URI reference has a relative path.
@returns
- `TRUE` if this URI reference is relative and has a relative path.
+ `TRUE` if this URI reference has a relative path.
*/
boolean hasRelativePath();
/**
- returns the number of path segments of this (hierarchical) URI reference.
+ returns the number of path segments of this URI reference.
- <p>For an opaque URI reference, and for a hierarchical URI reference with
- an empty path, the number of path segments is zero. For a hierarchical
+ <p>For a URI reference with
+ an empty path, the number of path segments is zero. For a
URI reference with an absolute, non-empty path, the number of path
segments equals the number of &ldquo;<code>/</code>&rdquo; delimiters.
- For a hierarchical URI reference with a relative, non-empty path, the
+ For a URI reference with a relative, non-empty path, the
number of path segments equals the number of &ldquo;<code>/</code>&rdquo;
delimiters, plus one.</p>
@@ -151,7 +153,7 @@ published interface XUriReference: com::sun::star::uno::XInterface {
long getPathSegmentCount();
/**
- returns a given path segment of this (hierarchical) URI reference.
+ returns a given path segment of this URI reference.
@param index
the index of the path segment, starting at zero.
@@ -159,27 +161,27 @@ published interface XUriReference: com::sun::star::uno::XInterface {
@returns
the textual representation of the given path segment (with the exact
spelling retained, without any delimiting &ldquo;<code>/</code>&rdquo;),
- if this URI reference is hierarchical and has that many path segments;
+ if this URI reference has that many path segments;
otherwise, and in particular if <code>index</code> is negative, an empty
`string` is returned.
*/
string getPathSegment([in] long index);
/**
- returns whether this (hierarchical) URI reference has a query part.
+ returns whether this URI reference has a query part.
@returns
- `TRUE` if this URI reference is hierarchical and has a query part.
+ `TRUE` if this URI reference has a query part.
*/
boolean hasQuery();
/**
- returns the query part of this (hierarchical) URI reference.
+ returns the query part of this URI reference.
@returns
the textual representation of the query part (with the exact spelling
retained; without the delimiting &ldquo;<code>?</code>&rdquo;), if this
- is a hierarchical URI reference that has a query part; otherwise, an
+ is a URI reference that has a query part; otherwise, an
empty `string` is returned.
*/
string getQuery();
diff --git a/udkapi/com/sun/star/uri/XUriReferenceFactory.idl b/udkapi/com/sun/star/uri/XUriReferenceFactory.idl
index 133f1f3cf23d..e87542aa4f58 100644
--- a/udkapi/com/sun/star/uri/XUriReferenceFactory.idl
+++ b/udkapi/com/sun/star/uri/XUriReferenceFactory.idl
@@ -29,7 +29,7 @@ module com { module sun { module star { module uri {
/**
creates URI references.
- <p>See <a href="http://www.ietf.org/rfc/rfc2396.txt">RFC&nbsp;2396</a> for a
+ <p>See <a href="http://www.ietf.org/rfc/rfc3986.txt">RFC&nbsp;3986</a> for a
description of URI references and related terms.</p>
@since OOo 2.0
@@ -59,35 +59,38 @@ published interface XUriReferenceFactory: com::sun::star::uno::XInterface {
@param uriReference
any URI reference. Backwards-compatible relative URI references starting
- with a scheme component (see RFC&nbsp;2396, Section&nbsp;5.2,
- step&nbsp;3) are not supported; instead, they are interpreted as absolute
+ with a scheme component (see RFC&nbsp;3986, Sections 5.2.2 and&nbsp;5.4,2)
+ are not supported; instead, they are interpreted as absolute
URI references.
- @param processSpecialBaseSegments
+ @param processAdditionalSpecialSegments
if `TRUE`, special segments (&ldquo;<code>.</code>&rdquo; and
&ldquo;<code>..</code>&rdquo;) within the path of the base URI (except
- for the last, cut-off segment) are processed as suggested by
- RFC&nbsp;2396. If `FALSE`, special segments within the path of the base
- URI are treated like ordinary segments.
+ for the last, cut-off segment), and within an already absolute <code>uriReference</code>, are
+ processed as required by
+ RFC&nbsp;3986. If `FALSE`, such special segments
+ are treated like ordinary segments.
+ Conformance with RFC&nbsp;3986 requires `TRUE` to be passed.
@param excessParentSegments
details how excess special parent segments
(&ldquo;<code>..</code>&rdquo;) are handled.
+ Conformance with RFC&nbsp;3986 requires REMOVE to be passed.
@returns
a fresh object that supports
com::sun::star::uri::XUriReference (and possibly also
additional, scheme-specific interfaces), if the given
- <code>uriReference</code> is either already absolute, or can be resolved
+ <code>uriReference</code> can be resolved
to an absolute URI reference, relative to the given
<code>baseUriReference</code>; otherwise, `NULL` is returned.
Especially, if <code>baseUriReference</code> is `NULL`, or is not an
- absolute, hierarchical URI reference, or if <code>uriReference</code> is
+ absolute URI reference, or if <code>uriReference</code> is
`NULL`, then `NULL` is always returned.
*/
XUriReference makeAbsolute(
[in] XUriReference baseUriReference, [in] XUriReference uriReference,
- [in] boolean processSpecialBaseSegments,
+ [in] boolean processAdditionalSpecialSegments,
[in] RelativeUriExcessParentSegments excessParentSegments);
/**
@@ -134,13 +137,13 @@ published interface XUriReferenceFactory: com::sun::star::uno::XInterface {
@returns
a fresh object that supports
com::sun::star::uri::XUriReference, if the given
- <code>uriReference</code> is either already relative, or is not
- hierarchical, or is of a different scheme than the given
+ <code>uriReference</code> is either already relative, or has a relative
+ path, or is of a different scheme than the given
<code>baseUriReference</code>, or can be changed to a relative URI
reference, relative to the given <code>baseUriReference</code>;
otherwise, `NULL` is returned. Especially, if
- <code>baseUriReference</code> is `NULL`, or is not an absolute,
- hierarchical URI reference, or if <code>uriReference</code> is `NULL`,
+ <code>baseUriReference</code> is `NULL`, or is not an absolute
+ URI reference, or if <code>uriReference</code> is `NULL`,
then `NULL` is always returned.
*/
XUriReference makeRelative(
diff --git a/udkapi/com/sun/star/uri/XUriSchemeParser.idl b/udkapi/com/sun/star/uri/XUriSchemeParser.idl
index e07aec8e4c7a..573a3cfb918c 100644
--- a/udkapi/com/sun/star/uri/XUriSchemeParser.idl
+++ b/udkapi/com/sun/star/uri/XUriSchemeParser.idl
@@ -28,7 +28,7 @@ module com { module sun { module star { module uri {
/**
parses textual representations of absolute URIs.
- <p>See <a href="http://www.ietf.org/rfc/rfc2396.txt">RFC&nbsp;2396</a> for a
+ <p>See <a href="http://www.ietf.org/rfc/rfc3986.txt">RFC&nbsp;3986</a> for a
description of URIs and related terms.</p>
@since OOo 2.0
diff --git a/udkapi/com/sun/star/uri/XVndSunStarExpandUrl.idl b/udkapi/com/sun/star/uri/XVndSunStarExpandUrl.idl
index 0bcfe32a5458..8de9d5380096 100644
--- a/udkapi/com/sun/star/uri/XVndSunStarExpandUrl.idl
+++ b/udkapi/com/sun/star/uri/XVndSunStarExpandUrl.idl
@@ -38,8 +38,7 @@ module com { module sun { module star { module uri {
where the <var>opaque_part</var> is a UTF-8 string as described in
<a href="http://udk.openoffice.org/common/man/concept/micro_deployment.html">
Bootstrap Arguments and Micro Deployment</a>. See
- <a href="http://www.ietf.org/rfc/rfc2396.txt">RFC&nbsp;2396</a>,
- <a href="http://www.ietf.org/rfc/rfc2732.txt">RFC&nbsp;2732</a>, and
+ <a href="http://www.ietf.org/rfc/rfc3986.txt">RFC&nbsp;3986</a>
<a href="http://www.ietf.org/rfc/rfc2234.txt">RFC&nbsp;2234</a> for
details.</p>
diff --git a/udkapi/com/sun/star/uri/XVndSunStarScriptUrl.idl b/udkapi/com/sun/star/uri/XVndSunStarScriptUrl.idl
index bd5295930fa7..ca703bcf4bdb 100644
--- a/udkapi/com/sun/star/uri/XVndSunStarScriptUrl.idl
+++ b/udkapi/com/sun/star/uri/XVndSunStarScriptUrl.idl
@@ -41,8 +41,7 @@ module com { module sun { module star { module uri {
<code>"$"</code> / <code>"+"</code> / <code>","</code> / <code>":"</code> /
<code>";"</code> / <code>"@"</code> / <code>"["</code> /
<code>"]"</code><br/>
- See <a href="http://www.ietf.org/rfc/rfc2396.txt">RFC&nbsp;2396</a>,
- <a href="http://www.ietf.org/rfc/rfc2732.txt">RFC&nbsp;2732</a>, and
+ See <a href="http://www.ietf.org/rfc/rfc3986.txt">RFC&nbsp;3986</a>
<a href="http://www.ietf.org/rfc/rfc2234.txt">RFC&nbsp;2234</a> for
details.</p>
diff --git a/udkapi/type_reference/udkapi.idl b/udkapi/type_reference/udkapi.idl
index 5000acfc73e1..071173d15cd5 100644
--- a/udkapi/type_reference/udkapi.idl
+++ b/udkapi/type_reference/udkapi.idl
@@ -1844,7 +1844,7 @@ module com {
published interface XUriReferenceFactory {
interface ::com::sun::star::uno::XInterface;
::com::sun::star::uri::XUriReference parse([in] string uriReference);
- ::com::sun::star::uri::XUriReference makeAbsolute([in] ::com::sun::star::uri::XUriReference baseUriReference, [in] ::com::sun::star::uri::XUriReference uriReference, [in] boolean processSpecialBaseSegments, [in] ::com::sun::star::uri::RelativeUriExcessParentSegments excessParentSegments);
+ ::com::sun::star::uri::XUriReference makeAbsolute([in] ::com::sun::star::uri::XUriReference baseUriReference, [in] ::com::sun::star::uri::XUriReference uriReference, [in] boolean processAdditionalSpecialSegments, [in] ::com::sun::star::uri::RelativeUriExcessParentSegments excessParentSegments);
::com::sun::star::uri::XUriReference makeRelative([in] ::com::sun::star::uri::XUriReference baseUriReference, [in] ::com::sun::star::uri::XUriReference uriReference, [in] boolean preferAuthorityOverRelativePath, [in] boolean preferAbsoluteOverRelativePath, [in] boolean encodeRetainedSpecialSegments);
};
published service UriReferenceFactory: ::com::sun::star::uri::XUriReferenceFactory;