Added new field for entire URL string

master
Aadhavan Srinivasan 2 years ago
parent d0d1660367
commit 49030166f3

@ -7,6 +7,7 @@ struct URL_s {
char* hostname;
char* port;
char* filepath;
char* url_str;
};
char* get_schema(URL* url) {
@ -26,11 +27,15 @@ char* get_filepath(URL* url) {
}
char* url_to_str(URL* url) {
return url->url_str;
}
URL* new_url(char* url_str) {
char* url_dup = strdup(url_str);
URL* url = malloc(sizeof(struct URL_s));
url->url_str = strdup(url_str);
url->schema = strtok(url_dup,":");
url->schema = strtok(url->url_str,":");
url->hostname = strtok(NULL,"/");

Loading…
Cancel
Save