Lines Matching refs:u
89 static void free_urlhandle(struct Curl_URL *u) in free_urlhandle() argument
91 free(u->scheme); in free_urlhandle()
92 free(u->user); in free_urlhandle()
93 free(u->password); in free_urlhandle()
94 free(u->options); in free_urlhandle()
95 free(u->host); in free_urlhandle()
96 free(u->zoneid); in free_urlhandle()
97 free(u->port); in free_urlhandle()
98 free(u->path); in free_urlhandle()
99 free(u->query); in free_urlhandle()
100 free(u->fragment); in free_urlhandle()
427 static CURLUcode parse_hostname_login(struct Curl_URL *u, in parse_hostname_login() argument
462 if(u->scheme) in parse_hostname_login()
463 h = Curl_get_scheme_handler(u->scheme); in parse_hostname_login()
482 free(u->user); in parse_hostname_login()
483 u->user = userp; in parse_hostname_login()
487 free(u->password); in parse_hostname_login()
488 u->password = passwdp; in parse_hostname_login()
492 free(u->options); in parse_hostname_login()
493 u->options = optionsp; in parse_hostname_login()
505 u->user = NULL; in parse_hostname_login()
506 u->password = NULL; in parse_hostname_login()
507 u->options = NULL; in parse_hostname_login()
512 UNITTEST CURLUcode Curl_parse_port(struct Curl_URL *u, struct dynbuf *host, in Curl_parse_port() argument
562 u->portnum = (unsigned short) port; in Curl_parse_port()
564 free(u->port); in Curl_parse_port()
565 u->port = aprintf("%ld", port); in Curl_parse_port()
566 if(!u->port) in Curl_parse_port()
574 static CURLUcode ipv6_parse(struct Curl_URL *u, char *hostname, in ipv6_parse() argument
602 u->zoneid = strdup(zoneid); in ipv6_parse()
603 if(!u->zoneid) in ipv6_parse()
628 static CURLUcode hostname_check(struct Curl_URL *u, char *hostname, in hostname_check() argument
637 return ipv6_parse(u, hostname, hlen); in hostname_check()
788 static CURLUcode parse_authority(struct Curl_URL *u, in parse_authority() argument
801 uc = parse_hostname_login(u, auth, authlen, flags, &offset); in parse_authority()
811 uc = Curl_parse_port(u, host, has_scheme); in parse_authority()
822 uc = ipv6_parse(u, Curl_dyn_ptr(host), Curl_dyn_len(host)); in parse_authority()
827 uc = hostname_check(u, Curl_dyn_ptr(host), Curl_dyn_len(host)); in parse_authority()
842 CURLUcode Curl_url_set_authority(CURLU *u, const char *authority) in Curl_url_set_authority() argument
850 result = parse_authority(u, authority, strlen(authority), in Curl_url_set_authority()
851 CURLU_DISALLOW_USER, &host, !!u->scheme); in Curl_url_set_authority()
855 free(u->host); in Curl_url_set_authority()
856 u->host = Curl_dyn_ptr(&host); in Curl_url_set_authority()
992 static CURLUcode parseurl(const char *url, CURLU *u, unsigned int flags) in parseurl() argument
1030 u->scheme = strdup("file"); in parseurl()
1031 if(!u->scheme) { in parseurl()
1177 u->scheme = strdup(schemep); in parseurl()
1178 if(!u->scheme) { in parseurl()
1192 result = parse_authority(u, hostp, hostlen, flags, &host, schemelen); in parseurl()
1214 u->scheme = strdup(schemep); in parseurl()
1215 if(!u->scheme) { in parseurl()
1219 u->guessed_scheme = TRUE; in parseurl()
1238 u->fragment_present = TRUE; in parseurl()
1247 u->fragment = Curl_dyn_ptr(&enc); in parseurl()
1250 u->fragment = Curl_memdup0(fragment + 1, fraglen - 1); in parseurl()
1251 if(!u->fragment) { in parseurl()
1266 u->query_present = TRUE; in parseurl()
1275 u->query = Curl_dyn_ptr(&enc); in parseurl()
1278 u->query = Curl_memdup0(query + 1, qlen - 1); in parseurl()
1279 if(!u->query) { in parseurl()
1287 u->query = strdup(""); in parseurl()
1288 if(!u->query) { in parseurl()
1302 path = u->path = Curl_dyn_ptr(&enc); in parseurl()
1310 if(!u->path) { in parseurl()
1311 u->path = Curl_memdup0(path, pathlen); in parseurl()
1312 if(!u->path) { in parseurl()
1316 path = u->path; in parseurl()
1320 u->path[pathlen] = 0; in parseurl()
1331 free(u->path); in parseurl()
1332 u->path = dedot; in parseurl()
1337 u->host = Curl_dyn_ptr(&host); in parseurl()
1342 free_urlhandle(u); in parseurl()
1349 static CURLUcode parseurl_and_replace(const char *url, CURLU *u, in parseurl_and_replace() argument
1357 free_urlhandle(u); in parseurl_and_replace()
1358 *u = tmpurl; in parseurl_and_replace()
1370 void curl_url_cleanup(CURLU *u) in curl_url_cleanup() argument
1372 if(u) { in curl_url_cleanup()
1373 free_urlhandle(u); in curl_url_cleanup()
1374 free(u); in curl_url_cleanup()
1389 struct Curl_URL *u = calloc(1, sizeof(struct Curl_URL)); in curl_url_dup() local
1390 if(u) { in curl_url_dup()
1391 DUP(u, in, scheme); in curl_url_dup()
1392 DUP(u, in, user); in curl_url_dup()
1393 DUP(u, in, password); in curl_url_dup()
1394 DUP(u, in, options); in curl_url_dup()
1395 DUP(u, in, host); in curl_url_dup()
1396 DUP(u, in, port); in curl_url_dup()
1397 DUP(u, in, path); in curl_url_dup()
1398 DUP(u, in, query); in curl_url_dup()
1399 DUP(u, in, fragment); in curl_url_dup()
1400 DUP(u, in, zoneid); in curl_url_dup()
1401 u->portnum = in->portnum; in curl_url_dup()
1402 u->fragment_present = in->fragment_present; in curl_url_dup()
1403 u->query_present = in->query_present; in curl_url_dup()
1405 return u; in curl_url_dup()
1407 curl_url_cleanup(u); in curl_url_dup()
1411 CURLUcode curl_url_get(const CURLU *u, CURLUPart what, in curl_url_get() argument
1423 if(!u) in curl_url_get()
1431 ptr = u->scheme; in curl_url_get()
1434 if((flags & CURLU_NO_GUESS_SCHEME) && u->guessed_scheme) in curl_url_get()
1438 ptr = u->user; in curl_url_get()
1442 ptr = u->password; in curl_url_get()
1446 ptr = u->options; in curl_url_get()
1450 ptr = u->host; in curl_url_get()
1456 ptr = u->zoneid; in curl_url_get()
1460 ptr = u->port; in curl_url_get()
1463 if(!ptr && (flags & CURLU_DEFAULT_PORT) && u->scheme) { in curl_url_get()
1466 const struct Curl_handler *h = Curl_get_scheme_handler(u->scheme); in curl_url_get()
1472 else if(ptr && u->scheme) { in curl_url_get()
1475 const struct Curl_handler *h = Curl_get_scheme_handler(u->scheme); in curl_url_get()
1476 if(h && (h->defport == u->portnum) && in curl_url_get()
1482 ptr = u->path; in curl_url_get()
1487 ptr = u->query; in curl_url_get()
1495 ptr = u->fragment; in curl_url_get()
1497 if(!ptr && u->fragment_present && flags & CURLU_GET_EMPTY) in curl_url_get()
1504 char *options = u->options; in curl_url_get()
1505 char *port = u->port; in curl_url_get()
1508 u->fragment || (u->fragment_present && flags & CURLU_GET_EMPTY); in curl_url_get()
1510 (u->query && u->query[0]) || in curl_url_get()
1511 (u->query_present && flags & CURLU_GET_EMPTY); in curl_url_get()
1514 if(u->scheme && strcasecompare("file", u->scheme)) { in curl_url_get()
1516 u->path, in curl_url_get()
1518 u->fragment ? u->fragment : ""); in curl_url_get()
1520 else if(!u->host) in curl_url_get()
1525 if(u->scheme) in curl_url_get()
1526 scheme = u->scheme; in curl_url_get()
1544 if(h && (h->defport == u->portnum) && in curl_url_get()
1552 if(u->host[0] == '[') { in curl_url_get()
1553 if(u->zoneid) { in curl_url_get()
1556 size_t hostlen = strlen(u->host); in curl_url_get()
1558 if(Curl_dyn_addf(&enc, "%.*s%%25%s]", (int)hostlen - 1, u->host, in curl_url_get()
1559 u->zoneid)) in curl_url_get()
1565 allochost = curl_easy_escape(NULL, u->host, 0); in curl_url_get()
1570 if(!Curl_is_ASCII_name(u->host)) { in curl_url_get()
1574 CURLcode result = Curl_idn_decode(u->host, &allochost); in curl_url_get()
1582 if(Curl_is_ASCII_name(u->host) && !strncmp("xn--", u->host, 4)) { in curl_url_get()
1586 CURLcode result = Curl_idn_encode(u->host, &allochost); in curl_url_get()
1595 if(!(flags & CURLU_NO_GUESS_SCHEME) || !u->guessed_scheme) in curl_url_get()
1602 u->user ? u->user : "", in curl_url_get()
1603 u->password ? ":": "", in curl_url_get()
1604 u->password ? u->password : "", in curl_url_get()
1607 (u->user || u->password || options) ? "@": "", in curl_url_get()
1608 allochost ? allochost : u->host, in curl_url_get()
1611 u->path ? u->path : "/", in curl_url_get()
1613 u->query ? u->query : "", in curl_url_get()
1615 u->fragment ? u->fragment : ""); in curl_url_get()
1666 if(!Curl_is_ASCII_name(u->host)) { in curl_url_get()
1681 if(Curl_is_ASCII_name(u->host) && !strncmp("xn--", u->host, 4)) { in curl_url_get()
1702 CURLUcode curl_url_set(CURLU *u, CURLUPart what, in curl_url_set() argument
1714 if(!u) in curl_url_set()
1722 storep = &u->scheme; in curl_url_set()
1723 u->guessed_scheme = FALSE; in curl_url_set()
1726 storep = &u->user; in curl_url_set()
1729 storep = &u->password; in curl_url_set()
1732 storep = &u->options; in curl_url_set()
1735 storep = &u->host; in curl_url_set()
1738 storep = &u->zoneid; in curl_url_set()
1741 u->portnum = 0; in curl_url_set()
1742 storep = &u->port; in curl_url_set()
1745 storep = &u->path; in curl_url_set()
1748 storep = &u->query; in curl_url_set()
1749 u->query_present = FALSE; in curl_url_set()
1752 storep = &u->fragment; in curl_url_set()
1753 u->fragment_present = FALSE; in curl_url_set()
1762 free_urlhandle(u); in curl_url_set()
1763 memset(u, 0, sizeof(struct Curl_URL)); in curl_url_set()
1783 storep = &u->scheme; in curl_url_set()
1796 u->guessed_scheme = FALSE; in curl_url_set()
1800 storep = &u->user; in curl_url_set()
1803 storep = &u->password; in curl_url_set()
1806 storep = &u->options; in curl_url_set()
1809 storep = &u->host; in curl_url_set()
1810 Curl_safefree(u->zoneid); in curl_url_set()
1813 storep = &u->zoneid; in curl_url_set()
1831 free(u->port); in curl_url_set()
1832 u->port = tmp; in curl_url_set()
1833 u->portnum = (unsigned short)port; in curl_url_set()
1839 storep = &u->path; in curl_url_set()
1845 storep = &u->query; in curl_url_set()
1846 u->query_present = TRUE; in curl_url_set()
1849 storep = &u->fragment; in curl_url_set()
1850 u->fragment_present = TRUE; in curl_url_set()
1874 || curl_url_get(u, CURLUPART_URL, &oldurl, flags)) { in curl_url_set()
1875 return parseurl_and_replace(part, u, flags); in curl_url_set()
1885 uc = parseurl_and_replace(redired_url, u, flags); in curl_url_set()
1957 size_t querylen = u->query ? strlen(u->query) : 0; in curl_url_set()
1958 bool addamperand = querylen && (u->query[querylen -1] != '&'); in curl_url_set()
1963 if(Curl_dyn_addn(&qbuf, u->query, querylen)) /* add original query */ in curl_url_set()
1998 if(result || hostname_check(u, decoded, dlen)) in curl_url_set()
2002 else if(hostname_check(u, (char *)newp, n)) in curl_url_set()