X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=libcitadel%2Flib%2Ftools.c;h=fac3cb5ad6644f08cd52efc4dca0659f633b1155;hb=697ff734ecfc1136b27cc72aa88b89171e14661e;hp=60168fe91e0ca0cb3cd8c21cc38d775623b43515;hpb=aa1dac4da1fe668ed7b84fabdeb41525f265e764;p=citadel.git diff --git a/libcitadel/lib/tools.c b/libcitadel/lib/tools.c index 60168fe91..fac3cb5ad 100644 --- a/libcitadel/lib/tools.c +++ b/libcitadel/lib/tools.c @@ -1032,59 +1032,3 @@ void convert_spaces_to_underscores(char *str) } -/* - * Parse a URL into host, port number, and resource identifier. - * (This is used by various functions which might need to fetch web pages.) - */ -int parse_url(char *url, char *hostname, int *port, char *identifier) -{ - char protocol[1024]; - char scratch[1024]; - char *ptr = NULL; - char *nptr = NULL; - - strcpy(scratch, url); - ptr = (char *)strchr(scratch, ':'); - if (!ptr) { - return(1); /* no protocol specified */ - } - - strcpy(ptr, ""); - strcpy(protocol, scratch); - if (strcmp(protocol, "http")) { - return(2); /* not HTTP */ - } - - strcpy(scratch, url); - ptr = (char *) strstr(scratch, "//"); - if (!ptr) { - return(3); /* no server specified */ - } - ptr += 2; - - strcpy(hostname, ptr); - nptr = (char *)strchr(ptr, ':'); - if (!nptr) { - *port = 80; /* default */ - nptr = (char *)strchr(hostname, '/'); - } - else { - sscanf(nptr, ":%d", port); - nptr = (char *)strchr(hostname, ':'); - } - - if (nptr) { - *nptr = '\0'; - } - - nptr = (char *)strchr(ptr, '/'); - - if (!nptr) { - return(4); /* no url specified */ - } - - strcpy(identifier, nptr); - return(0); -} - -