Lines Matching defs:uri

2  * uri.c: set of generic URI related routines 
17 #include <libxml/uri.h>
219 * @uri: pointer to an xmlURI
226 xmlSaveUri(xmlURIPtr uri) {
232 if (uri == NULL) return(NULL);
244 if (uri->scheme != NULL) {
245 p = uri->scheme;
269 if (uri->opaque != NULL) {
270 p = uri->opaque;
292 if (uri->server != NULL) {
304 if (uri->user != NULL) {
305 p = uri->user;
343 p = uri->server;
357 if (uri->port > 0) {
368 len += snprintf((char *) &ret[len], max - len, ":%d", uri->port);
370 } else if (uri->authority != NULL) {
383 p = uri->authority;
408 } else if (uri->scheme != NULL) {
422 if (uri->path != NULL) {
423 p = uri->path;
449 if (uri->query_raw != NULL) {
461 p = uri->query_raw;
475 } else if (uri->query != NULL) {
487 p = uri->query;
511 if (uri->fragment != NULL) {
523 p = uri->fragment;
562 * @uri: pointer to an xmlURI
567 xmlPrintURI(FILE *stream, xmlURIPtr uri) {
570 out = xmlSaveUri(uri);
579 * @uri: pointer to an xmlURI
584 xmlCleanURI(xmlURIPtr uri) {
585 if (uri == NULL) return;
587 if (uri->scheme != NULL) xmlFree(uri->scheme);
588 uri->scheme = NULL;
589 if (uri->server != NULL) xmlFree(uri->server);
590 uri->server = NULL;
591 if (uri->user != NULL) xmlFree(uri->user);
592 uri->user = NULL;
593 if (uri->path != NULL) xmlFree(uri->path);
594 uri->path = NULL;
595 if (uri->fragment != NULL) xmlFree(uri->fragment);
596 uri->fragment = NULL;
597 if (uri->opaque != NULL) xmlFree(uri->opaque);
598 uri->opaque = NULL;
599 if (uri->authority != NULL) xmlFree(uri->authority);
600 uri->authority = NULL;
601 if (uri->query != NULL) xmlFree(uri->query);
602 uri->query = NULL;
603 if (uri->query_raw != NULL) xmlFree(uri->query_raw);
604 uri->query_raw = NULL;
609 * @uri: pointer to an xmlURI
614 xmlFreeURI(xmlURIPtr uri) {
615 if (uri == NULL) return;
617 if (uri->scheme != NULL) xmlFree(uri->scheme);
618 if (uri->server != NULL) xmlFree(uri->server);
619 if (uri->user != NULL) xmlFree(uri->user);
620 if (uri->path != NULL) xmlFree(uri->path);
621 if (uri->fragment != NULL) xmlFree(uri->fragment);
622 if (uri->opaque != NULL) xmlFree(uri->opaque);
623 if (uri->authority != NULL) xmlFree(uri->authority);
624 if (uri->query != NULL) xmlFree(uri->query);
625 if (uri->query_raw != NULL) xmlFree(uri->query_raw);
626 xmlFree(uri);
982 xmlURIPtr uri;
993 uri = xmlCreateURI();
994 if (uri != NULL) {
998 uri->cleanup = 1;
999 ret2 = xmlParseURIReference(uri, (const char *)str);
1001 xmlFreeURI(uri);
1006 if (!uri)
1011 if (uri->scheme) {
1012 segment = xmlURIEscapeStr(BAD_CAST uri->scheme, BAD_CAST "+-.");
1019 if (uri->authority) {
1021 xmlURIEscapeStr(BAD_CAST uri->authority, BAD_CAST "/?;:@");
1028 if (uri->user) {
1029 segment = xmlURIEscapeStr(BAD_CAST uri->user, BAD_CAST ";:&=+$,");
1037 if (uri->server) {
1038 segment = xmlURIEscapeStr(BAD_CAST uri->server, BAD_CAST "/?;:@");
1040 if (uri->user == NULL)
1046 if (uri->port) {
1049 snprintf((char *) port, 10, "%d", uri->port);
1054 if (uri->path) {
1056 xmlURIEscapeStr(BAD_CAST uri->path, BAD_CAST ":@&=+$,/?;");
1062 if (uri->query_raw) {
1064 ret = xmlStrcat(ret, BAD_CAST uri->query_raw);
1066 else if (uri->query) {
1068 xmlURIEscapeStr(BAD_CAST uri->query, BAD_CAST ";/?:@&=+,$");
1075 if (uri->opaque) {
1076 segment = xmlURIEscapeStr(BAD_CAST uri->opaque, BAD_CAST "");
1082 if (uri->fragment) {
1083 segment = xmlURIEscapeStr(BAD_CAST uri->fragment, BAD_CAST "#");
1090 xmlFreeURI(uri);
1104 * @uri: pointer to an URI structure
1108 * of the @uri structure.
1115 xmlParseURIFragment(xmlURIPtr uri, const char **str)
1126 if (uri != NULL) {
1127 if (uri->fragment != NULL)
1128 xmlFree(uri->fragment);
1129 if (uri->cleanup & 2)
1130 uri->fragment = STRNDUP(*str, cur - *str);
1132 uri->fragment = xmlURIUnescapeString(*str, cur - *str, NULL);
1140 * @uri: pointer to an URI structure
1150 xmlParseURIQuery(xmlURIPtr uri, const char **str)
1160 ((uri != NULL) && (uri->cleanup & 1) && (IS_UNWISE(cur))))
1162 if (uri != NULL) {
1163 if (uri->query != NULL)
1164 xmlFree(uri->query);
1165 if (uri->cleanup & 2)
1166 uri->query = STRNDUP(*str, cur - *str);
1168 uri->query = xmlURIUnescapeString(*str, cur - *str, NULL);
1173 if (uri->query_raw != NULL)
1174 xmlFree (uri->query_raw);
1175 uri->query_raw = STRNDUP (*str, cur - *str);
1183 * @uri: pointer to an URI structure
1193 xmlParseURIScheme(xmlURIPtr uri, const char **str) {
1204 if (uri != NULL) {
1205 if (uri->scheme != NULL) xmlFree(uri->scheme);
1206 uri->scheme = STRNDUP(*str, cur - *str);
1214 * @uri: pointer to an URI structure
1224 xmlParseURIOpaquePart(xmlURIPtr uri, const char **str)
1233 ((uri != NULL) && (uri->cleanup & 1) && (IS_UNWISE(cur))))) {
1238 ((uri != NULL) && (uri->cleanup & 1) && (IS_UNWISE(cur))))
1240 if (uri != NULL) {
1241 if (uri->opaque != NULL)
1242 xmlFree(uri->opaque);
1243 if (uri->cleanup & 2)
1244 uri->opaque = STRNDUP(*str, cur - *str);
1246 uri->opaque = xmlURIUnescapeString(*str, cur - *str, NULL);
1254 * @uri: pointer to an URI structure
1279 xmlParseURIServer(xmlURIPtr uri, const char **str) {
1296 if (uri != NULL) {
1297 if (uri->user != NULL) xmlFree(uri->user);
1298 if (uri->cleanup & 2)
1299 uri->user = STRNDUP(*str, cur - *str);
1301 uri->user = xmlURIUnescapeString(*str, cur - *str, NULL);
1305 if (uri != NULL) {
1306 if (uri->user != NULL) xmlFree(uri->user);
1307 uri->user = NULL;
1316 if (uri != NULL) {
1317 if (uri->authority != NULL) xmlFree(uri->authority);
1318 uri->authority = NULL;
1319 if (uri->server != NULL) xmlFree(uri->server);
1320 uri->server = NULL;
1321 uri->port = 0;
1357 if (uri != NULL) {
1358 if (uri->server != NULL) xmlFree(uri->server);
1359 uri->server = (char *)xmlStrndup((xmlChar *)host+1,
1410 if (uri != NULL) {
1411 if (uri->authority != NULL) xmlFree(uri->authority);
1412 uri->authority = NULL;
1414 if (uri->server != NULL) xmlFree(uri->server);
1415 if (uri->cleanup & 2)
1416 uri->server = STRNDUP(host, cur - host);
1418 uri->server = xmlURIUnescapeString(host, cur - host, NULL);
1427 if (uri != NULL)
1428 uri->port = 0;
1430 if (uri != NULL)
1431 uri->port = uri->port * 10 + (*cur - '0');
1442 * @uri: pointer to an URI structure
1453 xmlParseURIRelSegment(xmlURIPtr uri, const char **str)
1462 ((uri != NULL) && (uri->cleanup & 1) && (IS_UNWISE(cur))))) {
1467 ((uri != NULL) && (uri->cleanup & 1) && (IS_UNWISE(cur))))
1469 if (uri != NULL) {
1470 if (uri->path != NULL)
1471 xmlFree(uri->path);
1472 if (uri->cleanup & 2)
1473 uri->path = STRNDUP(*str, cur - *str);
1475 uri->path = xmlURIUnescapeString(*str, cur - *str, NULL);
1483 * @uri: pointer to an URI structure
1496 xmlParseURIPathSegments(xmlURIPtr uri, const char **str, int slash)
1507 ((uri != NULL) && (uri->cleanup & 1) && (IS_UNWISE(cur))))
1512 ((uri != NULL) && (uri->cleanup & 1) && (IS_UNWISE(cur))))
1519 if (uri != NULL) {
1530 if (uri->path != NULL) {
1531 len2 = strlen(uri->path);
1541 if (uri->path != NULL)
1542 memcpy(path, uri->path, len2);
1549 if (uri->cleanup & 2) {
1555 if (uri->path != NULL)
1556 xmlFree(uri->path);
1557 uri->path = path;
1565 * @uri: pointer to an URI structure
1587 xmlParseURIAuthority(xmlURIPtr uri, const char **str) {
1599 ret = xmlParseURIServer(uri, str);
1613 if (uri != NULL) {
1614 if (uri->server != NULL) xmlFree(uri->server);
1615 uri->server = NULL;
1616 if (uri->user != NULL) xmlFree(uri->user);
1617 uri->user = NULL;
1618 if (uri->authority != NULL) xmlFree(uri->authority);
1619 if (uri->cleanup & 2)
1620 uri->authority = STRNDUP(*str, cur - *str);
1622 uri->authority = xmlURIUnescapeString(*str, cur - *str, NULL);
1630 * @uri: pointer to an URI structure
1642 xmlParseURIHierPart(xmlURIPtr uri, const char **str) {
1653 ret = xmlParseURIAuthority(uri, &cur);
1658 ret = xmlParseURIPathSegments(uri, &cur, 1);
1662 ret = xmlParseURIPathSegments(uri, &cur, 1);
1670 ret = xmlParseURIQuery(uri, &cur);
1680 * @uri: pointer to an URI structure
1684 * of the @uri structure
1691 xmlParseAbsoluteURI(xmlURIPtr uri, const char **str) {
1700 ret = xmlParseURIScheme(uri, str);
1708 return(xmlParseURIHierPart(uri, str));
1709 return(xmlParseURIOpaquePart(uri, str));
1714 * @uri: pointer to an URI structure
1718 * of the @uri structure
1728 xmlParseRelativeURI(xmlURIPtr uri, const char **str) {
1738 ret = xmlParseURIAuthority(uri, &cur);
1743 ret = xmlParseURIPathSegments(uri, &cur, 1);
1747 ret = xmlParseURIPathSegments(uri, &cur, 1);
1749 ret = xmlParseURIRelSegment(uri, &cur);
1754 ret = xmlParseURIPathSegments(uri, &cur, 1);
1761 ret = xmlParseURIQuery(uri, &cur);
1771 * @uri: pointer to an URI structure
1775 * of the @uri structure
1782 xmlParseURIReference(xmlURIPtr uri, const char *str) {
1788 xmlCleanURI(uri);
1794 ret = xmlParseAbsoluteURI(uri, &str);
1796 xmlCleanURI(uri);
1798 ret = xmlParseRelativeURI(uri, &str);
1801 xmlCleanURI(uri);
1807 ret = xmlParseURIFragment(uri, &str);
1811 xmlCleanURI(uri);
1829 xmlURIPtr uri;
1834 uri = xmlCreateURI();
1835 if (uri != NULL) {
1836 ret = xmlParseURIReference(uri, str);
1838 xmlFreeURI(uri);
1842 return(uri);
1858 xmlURIPtr uri;
1863 uri = xmlCreateURI();
1864 if (uri != NULL) {
1866 uri->cleanup |= 2;
1868 ret = xmlParseURIReference(uri, str);
1870 xmlFreeURI(uri);
1874 return(uri);
2415 xmlURIPtr uri;
2421 if ((uri = xmlParseURI((const char *) path)) != NULL) {
2422 xmlFreeURI(uri);
2426 /* Check if this is an "absolute uri" */
2453 uri = xmlParseURI((const char *) escURI);
2455 if (uri != NULL) {
2456 xmlFreeURI(uri);
2468 uri = xmlCreateURI();
2469 if (uri == NULL) { /* Guard against 'out of memory' */
2476 uri->scheme = xmlStrdup(BAD_CAST "file");
2478 uri->path = xmlMallocAtomic(len + 2);
2479 if (uri->path == NULL) {
2480 xmlFreeURI(uri); /* Guard agains 'out of memory' */
2484 uri->path[0] = '/';
2485 p = uri->path + 1;
2488 uri->path = xmlStrdup(path);
2489 if (uri->path == NULL) {
2490 xmlFreeURI(uri);
2493 p = uri->path;
2502 if (uri->scheme == NULL) {
2503 ret = xmlStrdup((const xmlChar *) uri->path);
2505 ret = xmlSaveUri(uri);
2508 xmlFreeURI(uri);
2529 xmlURIPtr uri;
2536 if ((uri = xmlParseURI((const char *) path)) != NULL) {
2537 xmlFreeURI(uri);
2547 if ((uri = xmlParseURI((const char *) cal)) != NULL) {
2548 xmlFreeURI(uri);