diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2019-08-20 09:38:10 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2019-08-23 14:47:01 +0200 |
commit | 5bbf9ca7ccb60c9d90f2cabbe4be4962329fda61 (patch) | |
tree | 58eab725c95f9e5c79391342f0dcf0a30fd25cdd /stoc/test | |
parent | 9a251699d728fa6207b71406cd91aafb7803f453 (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>
Diffstat (limited to 'stoc/test')
-rw-r--r-- | stoc/test/uriproc/test_uriproc.cxx | 478 |
1 files changed, 439 insertions, 39 deletions
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( |