• Home
  • Raw
  • Download

Lines Matching full:uri

2  * uri.c: set of generic URI related routines
18 #include <libxml/uri.h>
27 * The definition of the URI regexp in the above RFC has no size limit
29 * data URI scheme as defined in RFC 2397. Even for data URI the usual
58 static void xmlCleanURI(xmlURIPtr uri);
204 * @uri: pointer to an URI structure
207 * Parse an URI scheme
214 xmlParse3986Scheme(xmlURIPtr uri, const char **str) { in xmlParse3986Scheme() argument
226 if (uri != NULL) { in xmlParse3986Scheme()
227 if (uri->scheme != NULL) xmlFree(uri->scheme); in xmlParse3986Scheme()
228 uri->scheme = STRNDUP(*str, cur - *str); in xmlParse3986Scheme()
236 * @uri: pointer to an URI structure
239 * Parse the query part of an URI
250 xmlParse3986Fragment(xmlURIPtr uri, const char **str) in xmlParse3986Fragment() argument
261 ((uri != NULL) && (uri->cleanup & 1) && (IS_UNWISE(cur)))) in xmlParse3986Fragment()
263 if (uri != NULL) { in xmlParse3986Fragment()
264 if (uri->fragment != NULL) in xmlParse3986Fragment()
265 xmlFree(uri->fragment); in xmlParse3986Fragment()
266 if (uri->cleanup & 2) in xmlParse3986Fragment()
267 uri->fragment = STRNDUP(*str, cur - *str); in xmlParse3986Fragment()
269 uri->fragment = xmlURIUnescapeString(*str, cur - *str, NULL); in xmlParse3986Fragment()
277 * @uri: pointer to an URI structure
280 * Parse the query part of an URI
287 xmlParse3986Query(xmlURIPtr uri, const char **str) in xmlParse3986Query() argument
297 ((uri != NULL) && (uri->cleanup & 1) && (IS_UNWISE(cur)))) in xmlParse3986Query()
299 if (uri != NULL) { in xmlParse3986Query()
300 if (uri->query != NULL) in xmlParse3986Query()
301 xmlFree(uri->query); in xmlParse3986Query()
302 if (uri->cleanup & 2) in xmlParse3986Query()
303 uri->query = STRNDUP(*str, cur - *str); in xmlParse3986Query()
305 uri->query = xmlURIUnescapeString(*str, cur - *str, NULL); in xmlParse3986Query()
310 if (uri->query_raw != NULL) in xmlParse3986Query()
311 xmlFree (uri->query_raw); in xmlParse3986Query()
312 uri->query_raw = STRNDUP (*str, cur - *str); in xmlParse3986Query()
320 * @uri: pointer to an URI structure
324 * of the @uri structure
331 xmlParse3986Port(xmlURIPtr uri, const char **str) in xmlParse3986Port() argument
349 if (uri != NULL) in xmlParse3986Port()
350 uri->port = port; in xmlParse3986Port()
359 * @uri: pointer to an URI structure
363 * of the @uri structure
370 xmlParse3986Userinfo(xmlURIPtr uri, const char **str) in xmlParse3986Userinfo() argument
379 if (uri != NULL) { in xmlParse3986Userinfo()
380 if (uri->user != NULL) xmlFree(uri->user); in xmlParse3986Userinfo()
381 if (uri->cleanup & 2) in xmlParse3986Userinfo()
382 uri->user = STRNDUP(*str, cur - *str); in xmlParse3986Userinfo()
384 uri->user = xmlURIUnescapeString(*str, cur - *str, NULL); in xmlParse3986Userinfo()
431 * @uri: pointer to an URI structure
435 * of the @uri structure
445 xmlParse3986Host(xmlURIPtr uri, const char **str) in xmlParse3986Host() argument
492 if (uri != NULL) { in xmlParse3986Host()
493 if (uri->authority != NULL) xmlFree(uri->authority); in xmlParse3986Host()
494 uri->authority = NULL; in xmlParse3986Host()
495 if (uri->server != NULL) xmlFree(uri->server); in xmlParse3986Host()
497 if (uri->cleanup & 2) in xmlParse3986Host()
498 uri->server = STRNDUP(host, cur - host); in xmlParse3986Host()
500 uri->server = xmlURIUnescapeString(host, cur - host, NULL); in xmlParse3986Host()
502 uri->server = NULL; in xmlParse3986Host()
510 * @uri: pointer to an URI structure
514 * of the @uri structure
521 xmlParse3986Authority(xmlURIPtr uri, const char **str) in xmlParse3986Authority() argument
530 ret = xmlParse3986Userinfo(uri, &cur); in xmlParse3986Authority()
535 ret = xmlParse3986Host(uri, &cur); in xmlParse3986Authority()
539 ret = xmlParse3986Port(uri, &cur); in xmlParse3986Authority()
553 * of the @uri structure
581 * @uri: pointer to an URI structure
585 * of the @uri structure
592 xmlParse3986PathAbEmpty(xmlURIPtr uri, const char **str) in xmlParse3986PathAbEmpty() argument
604 if (uri != NULL) { in xmlParse3986PathAbEmpty()
605 if (uri->path != NULL) xmlFree(uri->path); in xmlParse3986PathAbEmpty()
607 if (uri->cleanup & 2) in xmlParse3986PathAbEmpty()
608 uri->path = STRNDUP(*str, cur - *str); in xmlParse3986PathAbEmpty()
610 uri->path = xmlURIUnescapeString(*str, cur - *str, NULL); in xmlParse3986PathAbEmpty()
612 uri->path = NULL; in xmlParse3986PathAbEmpty()
621 * @uri: pointer to an URI structure
625 * of the @uri structure
632 xmlParse3986PathAbsolute(xmlURIPtr uri, const char **str) in xmlParse3986PathAbsolute() argument
650 if (uri != NULL) { in xmlParse3986PathAbsolute()
651 if (uri->path != NULL) xmlFree(uri->path); in xmlParse3986PathAbsolute()
653 if (uri->cleanup & 2) in xmlParse3986PathAbsolute()
654 uri->path = STRNDUP(*str, cur - *str); in xmlParse3986PathAbsolute()
656 uri->path = xmlURIUnescapeString(*str, cur - *str, NULL); in xmlParse3986PathAbsolute()
658 uri->path = NULL; in xmlParse3986PathAbsolute()
667 * @uri: pointer to an URI structure
671 * of the @uri structure
678 xmlParse3986PathRootless(xmlURIPtr uri, const char **str) in xmlParse3986PathRootless() argument
692 if (uri != NULL) { in xmlParse3986PathRootless()
693 if (uri->path != NULL) xmlFree(uri->path); in xmlParse3986PathRootless()
695 if (uri->cleanup & 2) in xmlParse3986PathRootless()
696 uri->path = STRNDUP(*str, cur - *str); in xmlParse3986PathRootless()
698 uri->path = xmlURIUnescapeString(*str, cur - *str, NULL); in xmlParse3986PathRootless()
700 uri->path = NULL; in xmlParse3986PathRootless()
709 * @uri: pointer to an URI structure
713 * of the @uri structure
720 xmlParse3986PathNoScheme(xmlURIPtr uri, const char **str) in xmlParse3986PathNoScheme() argument
734 if (uri != NULL) { in xmlParse3986PathNoScheme()
735 if (uri->path != NULL) xmlFree(uri->path); in xmlParse3986PathNoScheme()
737 if (uri->cleanup & 2) in xmlParse3986PathNoScheme()
738 uri->path = STRNDUP(*str, cur - *str); in xmlParse3986PathNoScheme()
740 uri->path = xmlURIUnescapeString(*str, cur - *str, NULL); in xmlParse3986PathNoScheme()
742 uri->path = NULL; in xmlParse3986PathNoScheme()
751 * @uri: pointer to an URI structure
755 * of the @uri structure
765 xmlParse3986HierPart(xmlURIPtr uri, const char **str) in xmlParse3986HierPart() argument
774 ret = xmlParse3986Authority(uri, &cur); in xmlParse3986HierPart()
777 * An empty server is marked with a special URI value. in xmlParse3986HierPart()
779 if ((uri->server == NULL) && (uri->port == PORT_EMPTY)) in xmlParse3986HierPart()
780 uri->port = PORT_EMPTY_SERVER; in xmlParse3986HierPart()
781 ret = xmlParse3986PathAbEmpty(uri, &cur); in xmlParse3986HierPart()
786 ret = xmlParse3986PathAbsolute(uri, &cur); in xmlParse3986HierPart()
789 ret = xmlParse3986PathRootless(uri, &cur); in xmlParse3986HierPart()
793 if (uri != NULL) { in xmlParse3986HierPart()
794 if (uri->path != NULL) xmlFree(uri->path); in xmlParse3986HierPart()
795 uri->path = NULL; in xmlParse3986HierPart()
804 * @uri: pointer to an URI structure
807 * Parse an URI string and fills in the appropriate fields
808 * of the @uri structure
819 xmlParse3986RelativeRef(xmlURIPtr uri, const char *str) { in xmlParse3986RelativeRef() argument
824 ret = xmlParse3986Authority(uri, &str); in xmlParse3986RelativeRef()
826 ret = xmlParse3986PathAbEmpty(uri, &str); in xmlParse3986RelativeRef()
829 ret = xmlParse3986PathAbsolute(uri, &str); in xmlParse3986RelativeRef()
832 ret = xmlParse3986PathNoScheme(uri, &str); in xmlParse3986RelativeRef()
836 if (uri != NULL) { in xmlParse3986RelativeRef()
837 if (uri->path != NULL) xmlFree(uri->path); in xmlParse3986RelativeRef()
838 uri->path = NULL; in xmlParse3986RelativeRef()
844 ret = xmlParse3986Query(uri, &str); in xmlParse3986RelativeRef()
849 ret = xmlParse3986Fragment(uri, &str); in xmlParse3986RelativeRef()
853 xmlCleanURI(uri); in xmlParse3986RelativeRef()
862 * @uri: pointer to an URI structure
865 * Parse an URI string and fills in the appropriate fields
866 * of the @uri structure
873 xmlParse3986URI(xmlURIPtr uri, const char *str) { in xmlParse3986URI() argument
876 ret = xmlParse3986Scheme(uri, &str); in xmlParse3986URI()
882 ret = xmlParse3986HierPart(uri, &str); in xmlParse3986URI()
886 ret = xmlParse3986Query(uri, &str); in xmlParse3986URI()
891 ret = xmlParse3986Fragment(uri, &str); in xmlParse3986URI()
895 xmlCleanURI(uri); in xmlParse3986URI()
903 * @uri: pointer to an URI structure
906 * Parse an URI reference string and fills in the appropriate fields
907 * of the @uri structure
909 * URI-reference = URI / relative-ref
914 xmlParse3986URIReference(xmlURIPtr uri, const char *str) { in xmlParse3986URIReference() argument
919 xmlCleanURI(uri); in xmlParse3986URIReference()
925 ret = xmlParse3986URI(uri, str); in xmlParse3986URIReference()
927 xmlCleanURI(uri); in xmlParse3986URIReference()
928 ret = xmlParse3986RelativeRef(uri, str); in xmlParse3986URIReference()
930 xmlCleanURI(uri); in xmlParse3986URIReference()
939 * @str: the URI string to analyze
941 * Parse an URI based on RFC 3986
943 * URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ]
949 xmlURIPtr uri; in xmlParseURI() local
954 uri = xmlCreateURI(); in xmlParseURI()
955 if (uri != NULL) { in xmlParseURI()
956 ret = xmlParse3986URIReference(uri, str); in xmlParseURI()
958 xmlFreeURI(uri); in xmlParseURI()
962 return(uri); in xmlParseURI()
967 * @uri: pointer to an URI structure
970 * Parse an URI reference string based on RFC 3986 and fills in the
971 * appropriate fields of the @uri structure
973 * URI-reference = URI / relative-ref
978 xmlParseURIReference(xmlURIPtr uri, const char *str) { in xmlParseURIReference() argument
979 return(xmlParse3986URIReference(uri, str)); in xmlParseURIReference()
984 * @str: the URI string to analyze
985 * @raw: if 1 unescaping of URI pieces are disabled
987 * Parse an URI but allows to keep intact the original fragments.
989 * URI-reference = URI / relative-ref
995 xmlURIPtr uri; in xmlParseURIRaw() local
1000 uri = xmlCreateURI(); in xmlParseURIRaw()
1001 if (uri != NULL) { in xmlParseURIRaw()
1003 uri->cleanup |= 2; in xmlParseURIRaw()
1005 ret = xmlParseURIReference(uri, str); in xmlParseURIRaw()
1007 xmlFreeURI(uri); in xmlParseURIRaw()
1011 return(uri); in xmlParseURIRaw()
1016 * Generic URI structure functions *
1033 xmlURIErrMemory("creating URI structure\n"); in xmlCreateURI()
1044 * Function to handle properly a reallocation when saving an URI
1045 * Also imposes some limit on the length of an URI string output
1059 xmlURIErrMemory("saving URI\n"); in xmlSaveUriRealloc()
1068 * @uri: pointer to an xmlURI
1070 * Save the URI as an escaped string
1075 xmlSaveUri(xmlURIPtr uri) { in xmlSaveUri() argument
1082 if (uri == NULL) return(NULL); in xmlSaveUri()
1088 xmlURIErrMemory("saving URI\n"); in xmlSaveUri()
1093 if (uri->scheme != NULL) { in xmlSaveUri()
1094 p = uri->scheme; in xmlSaveUri()
1110 if (uri->opaque != NULL) { in xmlSaveUri()
1111 p = uri->opaque; in xmlSaveUri()
1129 if ((uri->server != NULL) || (uri->port != PORT_EMPTY)) { in xmlSaveUri()
1137 if (uri->user != NULL) { in xmlSaveUri()
1138 p = uri->user; in xmlSaveUri()
1166 if (uri->server != NULL) { in xmlSaveUri()
1167 p = uri->server; in xmlSaveUri()
1178 if (uri->port > 0) { in xmlSaveUri()
1184 len += snprintf((char *) &ret[len], max - len, ":%d", uri->port); in xmlSaveUri()
1186 } else if (uri->authority != NULL) { in xmlSaveUri()
1194 p = uri->authority; in xmlSaveUri()
1214 } else if (uri->scheme != NULL) { in xmlSaveUri()
1221 if (uri->path != NULL) { in xmlSaveUri()
1222 p = uri->path; in xmlSaveUri()
1227 if ((uri->scheme != NULL) && in xmlSaveUri()
1232 (xmlStrEqual(BAD_CAST uri->scheme, BAD_CAST "file"))) { in xmlSaveUri()
1262 if (uri->query_raw != NULL) { in xmlSaveUri()
1269 p = uri->query_raw; in xmlSaveUri()
1278 } else if (uri->query != NULL) { in xmlSaveUri()
1285 p = uri->query; in xmlSaveUri()
1304 if (uri->fragment != NULL) { in xmlSaveUri()
1311 p = uri->fragment; in xmlSaveUri()
1345 * @uri: pointer to an xmlURI
1347 * Prints the URI in the stream @stream.
1350 xmlPrintURI(FILE *stream, xmlURIPtr uri) { in xmlPrintURI() argument
1353 out = xmlSaveUri(uri); in xmlPrintURI()
1362 * @uri: pointer to an xmlURI
1367 xmlCleanURI(xmlURIPtr uri) { in xmlCleanURI() argument
1368 if (uri == NULL) return; in xmlCleanURI()
1370 if (uri->scheme != NULL) xmlFree(uri->scheme); in xmlCleanURI()
1371 uri->scheme = NULL; in xmlCleanURI()
1372 if (uri->server != NULL) xmlFree(uri->server); in xmlCleanURI()
1373 uri->server = NULL; in xmlCleanURI()
1374 if (uri->user != NULL) xmlFree(uri->user); in xmlCleanURI()
1375 uri->user = NULL; in xmlCleanURI()
1376 if (uri->path != NULL) xmlFree(uri->path); in xmlCleanURI()
1377 uri->path = NULL; in xmlCleanURI()
1378 if (uri->fragment != NULL) xmlFree(uri->fragment); in xmlCleanURI()
1379 uri->fragment = NULL; in xmlCleanURI()
1380 if (uri->opaque != NULL) xmlFree(uri->opaque); in xmlCleanURI()
1381 uri->opaque = NULL; in xmlCleanURI()
1382 if (uri->authority != NULL) xmlFree(uri->authority); in xmlCleanURI()
1383 uri->authority = NULL; in xmlCleanURI()
1384 if (uri->query != NULL) xmlFree(uri->query); in xmlCleanURI()
1385 uri->query = NULL; in xmlCleanURI()
1386 if (uri->query_raw != NULL) xmlFree(uri->query_raw); in xmlCleanURI()
1387 uri->query_raw = NULL; in xmlCleanURI()
1392 * @uri: pointer to an xmlURI
1397 xmlFreeURI(xmlURIPtr uri) { in xmlFreeURI() argument
1398 if (uri == NULL) return; in xmlFreeURI()
1400 if (uri->scheme != NULL) xmlFree(uri->scheme); in xmlFreeURI()
1401 if (uri->server != NULL) xmlFree(uri->server); in xmlFreeURI()
1402 if (uri->user != NULL) xmlFree(uri->user); in xmlFreeURI()
1403 if (uri->path != NULL) xmlFree(uri->path); in xmlFreeURI()
1404 if (uri->fragment != NULL) xmlFree(uri->fragment); in xmlFreeURI()
1405 if (uri->opaque != NULL) xmlFree(uri->opaque); in xmlFreeURI()
1406 if (uri->authority != NULL) xmlFree(uri->authority); in xmlFreeURI()
1407 if (uri->query != NULL) xmlFree(uri->query); in xmlFreeURI()
1408 if (uri->query_raw != NULL) xmlFree(uri->query_raw); in xmlFreeURI()
1409 xmlFree(uri); in xmlFreeURI()
1584 * treating them as part of the final URI), by removing them from in xmlNormalizeURIPath()
1621 * Unescaping routine, but does not check that the string is an URI. The
1642 xmlURIErrMemory("unescaping URI value\n"); in xmlURIUnescapeString()
1706 xmlURIErrMemory("escaping URI value\n"); in xmlURIEscapeStr()
1715 xmlURIErrMemory("escaping URI value\n"); in xmlURIEscapeStr()
1749 * @str: the string of the URI to escape
1766 xmlURIPtr uri; in xmlURIEscape() local
1772 uri = xmlCreateURI(); in xmlURIEscape()
1773 if (uri != NULL) { in xmlURIEscape()
1777 uri->cleanup = 1; in xmlURIEscape()
1778 ret2 = xmlParseURIReference(uri, (const char *)str); in xmlURIEscape()
1780 xmlFreeURI(uri); in xmlURIEscape()
1785 if (!uri) in xmlURIEscape()
1791 xmlURIErrMemory("escaping URI value\n"); \ in xmlURIEscape()
1792 xmlFreeURI(uri); \ in xmlURIEscape()
1796 if (uri->scheme) { in xmlURIEscape()
1797 segment = xmlURIEscapeStr(BAD_CAST uri->scheme, BAD_CAST "+-."); in xmlURIEscape()
1804 if (uri->authority) { in xmlURIEscape()
1806 xmlURIEscapeStr(BAD_CAST uri->authority, BAD_CAST "/?;:@"); in xmlURIEscape()
1813 if (uri->user) { in xmlURIEscape()
1814 segment = xmlURIEscapeStr(BAD_CAST uri->user, BAD_CAST ";:&=+$,"); in xmlURIEscape()
1822 if (uri->server) { in xmlURIEscape()
1823 segment = xmlURIEscapeStr(BAD_CAST uri->server, BAD_CAST "/?;:@"); in xmlURIEscape()
1825 if (uri->user == NULL) in xmlURIEscape()
1831 if (uri->port > 0) { in xmlURIEscape()
1834 snprintf((char *) port, 11, "%d", uri->port); in xmlURIEscape()
1839 if (uri->path) { in xmlURIEscape()
1841 xmlURIEscapeStr(BAD_CAST uri->path, BAD_CAST ":@&=+$,/?;"); in xmlURIEscape()
1847 if (uri->query_raw) { in xmlURIEscape()
1849 ret = xmlStrcat(ret, BAD_CAST uri->query_raw); in xmlURIEscape()
1851 else if (uri->query) { in xmlURIEscape()
1853 xmlURIEscapeStr(BAD_CAST uri->query, BAD_CAST ";/?:@&=+,$"); in xmlURIEscape()
1860 if (uri->opaque) { in xmlURIEscape()
1861 segment = xmlURIEscapeStr(BAD_CAST uri->opaque, BAD_CAST ""); in xmlURIEscape()
1867 if (uri->fragment) { in xmlURIEscape()
1868 segment = xmlURIEscapeStr(BAD_CAST uri->fragment, BAD_CAST "#"); in xmlURIEscape()
1875 xmlFreeURI(uri); in xmlURIEscape()
1889 * @URI: the URI instance found in the document
1892 * Computes he final URI of the reference done by checking that
1893 * the given URI is valid, and building the final URI using the
1894 * base URI. This is processed according to section 5.2 of the
1899 * Returns a new URI string (to be freed by the caller) or NULL in case
1903 xmlBuildURI(const xmlChar *URI, const xmlChar *base) { in xmlBuildURI() argument
1911 * 1) The URI reference is parsed into the potential four components and in xmlBuildURI()
1914 * NOTE that a completely empty URI is treated by modern browsers in xmlBuildURI()
1916 * URI. Should we do that here? in xmlBuildURI()
1918 if (URI == NULL) in xmlBuildURI()
1921 if (*URI) { in xmlBuildURI()
1925 ret = xmlParseURIReference(ref, (const char *) URI); in xmlBuildURI()
1934 * The URI is absolute don't modify. in xmlBuildURI()
1936 val = xmlStrdup(URI); in xmlBuildURI()
1967 * current document and we are done. Otherwise, the reference URI's in xmlBuildURI()
1969 * within the URI reference and not inherited from the base URI. in xmlBuildURI()
2011 * absolute URI and we are done. Otherwise, the reference URI's in xmlBuildURI()
2012 * scheme is inherited from the base URI's scheme component. in xmlBuildURI()
2031 * URI's authority is inherited from the base URI's authority in xmlBuildURI()
2032 * component, which will also be undefined if the URI scheme does not in xmlBuildURI()
2073 * URI's path. Although there are many ways to do this, we will in xmlBuildURI()
2085 xmlURIErrMemory("resolving URI against base\n"); in xmlBuildURI()
2091 * a) All but the last segment of the base URI's path component is in xmlBuildURI()
2138 * 7) The resulting URI components, including any inherited from the in xmlBuildURI()
2139 * base URI, are recombined to give the absolute form of the URI in xmlBuildURI()
2156 * @URI: the URI reference under consideration
2159 * Expresses the URI of the reference in terms relative to the
2162 * URI input URI returned
2170 * URI input URI returned
2177 * Note: if the URI reference is really weird or complicated, it may be
2180 * since this routine (for reasonable efficiency) assumes URI has
2183 * Returns a new URI string (to be freed by the caller) or NULL in case
2187 xmlBuildRelativeURI (const xmlChar * URI, const xmlChar * base) in xmlBuildRelativeURI() argument
2199 if ((URI == NULL) || (*URI == 0)) in xmlBuildRelativeURI()
2203 * First parse URI into a standard form in xmlBuildRelativeURI()
2208 /* If URI not already in "relative" form */ in xmlBuildRelativeURI()
2209 if (URI[0] != '.') { in xmlBuildRelativeURI()
2210 ret = xmlParseURIReference (ref, (const char *) URI); in xmlBuildRelativeURI()
2212 goto done; /* Error in URI, return NULL */ in xmlBuildRelativeURI()
2214 ref->path = (char *)xmlStrdup(URI); in xmlBuildRelativeURI()
2220 val = xmlStrdup (URI); in xmlBuildRelativeURI()
2234 * If the scheme / server on the URI differs from the base, in xmlBuildRelativeURI()
2235 * just return the URI in xmlBuildRelativeURI()
2242 val = xmlStrdup (URI); in xmlBuildRelativeURI()
2287 * In URI, "back up" to the last '/' encountered. This will be the in xmlBuildRelativeURI()
2288 * beginning of the "unique" suffix of URI in xmlBuildRelativeURI()
2306 * e.g: URI="foo/" base="foo/bar" -> "./" in xmlBuildRelativeURI()
2325 * length of the remainder of the URI, plus enough space in xmlBuildRelativeURI()
2330 xmlURIErrMemory("building relative URI\n"); in xmlBuildRelativeURI()
2343 * Finish up with the end of the URI in xmlBuildRelativeURI()
2405 xmlURIPtr uri; in xmlCanonicPath() local
2425 /* sanitize filename starting with // so it can be used as URI */ in xmlCanonicPath()
2429 if ((uri = xmlParseURI((const char *) path)) != NULL) { in xmlCanonicPath()
2430 xmlFreeURI(uri); in xmlCanonicPath()
2434 /* Check if this is an "absolute uri" */ in xmlCanonicPath()
2442 * this looks like an URI where some parts have not been in xmlCanonicPath()
2461 uri = xmlParseURI((const char *) escURI); in xmlCanonicPath()
2463 if (uri != NULL) { in xmlCanonicPath()
2464 xmlFreeURI(uri); in xmlCanonicPath()
2475 * Create a URI structure in xmlCanonicPath()
2477 uri = xmlCreateURI(); in xmlCanonicPath()
2478 if (uri == NULL) { /* Guard against 'out of memory' */ in xmlCanonicPath()
2485 uri->scheme = (char *) xmlStrdup(BAD_CAST "file"); in xmlCanonicPath()
2487 uri->path = xmlMallocAtomic(len + 2); in xmlCanonicPath()
2488 if (uri->path == NULL) { in xmlCanonicPath()
2489 xmlFreeURI(uri); /* Guard against 'out of memory' */ in xmlCanonicPath()
2493 uri->path[0] = '/'; in xmlCanonicPath()
2494 p = uri->path + 1; in xmlCanonicPath()
2497 uri->path = (char *) xmlStrdup(path); in xmlCanonicPath()
2498 if (uri->path == NULL) { in xmlCanonicPath()
2499 xmlFreeURI(uri); in xmlCanonicPath()
2502 p = uri->path; in xmlCanonicPath()
2511 if (uri->scheme == NULL) { in xmlCanonicPath()
2512 ret = xmlStrdup((const xmlChar *) uri->path); in xmlCanonicPath()
2514 ret = xmlSaveUri(uri); in xmlCanonicPath()
2517 xmlFreeURI(uri); in xmlCanonicPath()
2528 * Constructs an URI expressing the existing path
2530 * Returns a new URI, or a duplicate of the path parameter if the
2538 xmlURIPtr uri; in xmlPathToURI() local
2545 if ((uri = xmlParseURI((const char *) path)) != NULL) { in xmlPathToURI()
2546 xmlFreeURI(uri); in xmlPathToURI()
2553 /* xmlCanonicPath can return an URI on Windows (is that the intended behaviour?) in xmlPathToURI()
2554 If 'cal' is a valid URI already then we are done here, as continuing would make in xmlPathToURI()
2556 if ((uri = xmlParseURI((const char *) cal)) != NULL) { in xmlPathToURI()
2557 xmlFreeURI(uri); in xmlPathToURI()