diff options
author | Jörg Frings-Fürst <debian@jff-webhsoting.net> | 2014-10-20 18:43:39 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhsoting.net> | 2014-10-20 18:43:39 +0200 |
commit | 7cf57ee38648ce5729b97209e4bf87ae92c726b6 (patch) | |
tree | 7a1e89b9c5e85db7ecd736cb0fa375277de8def1 /src/UriResolve.c | |
parent | 58048f62e9ce8d1754192edd702f7f3bbcea24c6 (diff) | |
parent | c3ccf5e3e6737f81863b085289fd830e732b41f9 (diff) |
Merge tag 'upstream/0.8.1'
Upstream version 0.8.1
Diffstat (limited to 'src/UriResolve.c')
-rw-r--r-- | src/UriResolve.c | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/src/UriResolve.c b/src/UriResolve.c index 2873060..4af5b19 100644 --- a/src/UriResolve.c +++ b/src/UriResolve.c @@ -150,7 +150,8 @@ static int URI_FUNC(ResolveAbsolutePathFlag)(URI_TYPE(Uri) * absWork) { static int URI_FUNC(AddBaseUriImpl)(URI_TYPE(Uri) * absDest, const URI_TYPE(Uri) * relSource, - const URI_TYPE(Uri) * absBase) { + const URI_TYPE(Uri) * absBase, + UriResolutionOptions options) { if (absDest == NULL) { return URI_ERROR_NULL; } @@ -165,8 +166,20 @@ static int URI_FUNC(AddBaseUriImpl)(URI_TYPE(Uri) * absDest, return URI_ERROR_ADDBASE_REL_BASE; } + /* [00/32] -- A non-strict parser may ignore a scheme in the reference */ + /* [00/32] -- if it is identical to the base URI's scheme. */ + /* [00/32] if ((not strict) and (R.scheme == Base.scheme)) then */ + UriBool relSourceHasScheme = (relSource->scheme.first != NULL) ? URI_TRUE : URI_FALSE; + if ((options & URI_RESOLVE_IDENTICAL_SCHEME_COMPAT) + && (absBase->scheme.first != NULL) + && (0 == URI_FUNC(CompareRange)(&(absBase->scheme), &(relSource->scheme)))) { + /* [00/32] undefine(R.scheme); */ + relSourceHasScheme = URI_FALSE; + /* [00/32] endif; */ + } + /* [01/32] if defined(R.scheme) then */ - if (relSource->scheme.first != NULL) { + if (relSourceHasScheme) { /* [02/32] T.scheme = R.scheme; */ absDest->scheme = relSource->scheme; /* [03/32] T.authority = R.authority; */ @@ -278,7 +291,19 @@ static int URI_FUNC(AddBaseUriImpl)(URI_TYPE(Uri) * absDest, int URI_FUNC(AddBaseUri)(URI_TYPE(Uri) * absDest, const URI_TYPE(Uri) * relSource, const URI_TYPE(Uri) * absBase) { - const int res = URI_FUNC(AddBaseUriImpl)(absDest, relSource, absBase); + const int res = URI_FUNC(AddBaseUriImpl)(absDest, relSource, absBase, URI_RESOLVE_STRICTLY); + if ((res != URI_SUCCESS) && (absDest != NULL)) { + URI_FUNC(FreeUriMembers)(absDest); + } + return res; +} + + + +int URI_FUNC(AddBaseUriEx)(URI_TYPE(Uri) * absDest, + const URI_TYPE(Uri) * relSource, const URI_TYPE(Uri) * absBase, + UriResolutionOptions options) { + const int res = URI_FUNC(AddBaseUriImpl)(absDest, relSource, absBase, options); if ((res != URI_SUCCESS) && (absDest != NULL)) { URI_FUNC(FreeUriMembers)(absDest); } |